OpenCores
URL https://opencores.org/ocsvn/eco32/eco32/trunk

Subversion Repositories eco32

[/] [eco32/] [tags/] [eco32-0.25/] [lcc/] [lburg/] [lburg.h] - Diff between revs 4 and 248

Only display areas with differences | Details | Blame | View Log

Rev 4 Rev 248
#ifndef BURG_INCLUDED
#ifndef BURG_INCLUDED
 
 
#define BURG_INCLUDED
#define BURG_INCLUDED
 
 
 
 
 
 
/* $Id: lburg.h,v 2.1 1994/11/30 21:53:18 drh Exp $ */
/* $Id: lburg.h,v 2.1 1994/11/30 21:53:18 drh Exp $ */
 
 
/* iburg.c: */
/* iburg.c: */
 
 
extern void *alloc(int nbytes);
extern void *alloc(int nbytes);
 
 
 
 
 
 
typedef enum { TERM=1, NONTERM } Kind;
typedef enum { TERM=1, NONTERM } Kind;
 
 
typedef struct rule *Rule;
typedef struct rule *Rule;
 
 
typedef struct term *Term;
typedef struct term *Term;
 
 
struct term {           /* terminals: */
struct term {           /* terminals: */
 
 
        char *name;             /* terminal name */
        char *name;             /* terminal name */
 
 
        Kind kind;              /* TERM */
        Kind kind;              /* TERM */
 
 
        int esn;                /* external symbol number */
        int esn;                /* external symbol number */
 
 
        int arity;              /* operator arity */
        int arity;              /* operator arity */
 
 
        Term link;              /* next terminal in esn order */
        Term link;              /* next terminal in esn order */
 
 
        Rule rules;             /* rules whose pattern starts with term */
        Rule rules;             /* rules whose pattern starts with term */
 
 
};
};
 
 
 
 
 
 
typedef struct nonterm *Nonterm;
typedef struct nonterm *Nonterm;
 
 
struct nonterm {        /* nonterminals: */
struct nonterm {        /* nonterminals: */
 
 
        char *name;             /* nonterminal name */
        char *name;             /* nonterminal name */
 
 
        Kind kind;              /* NONTERM */
        Kind kind;              /* NONTERM */
 
 
        int number;             /* identifying number */
        int number;             /* identifying number */
 
 
        int lhscount;           /* # times nt appears in a rule lhs */
        int lhscount;           /* # times nt appears in a rule lhs */
 
 
        int reached;            /* 1 iff reached from start nonterminal */
        int reached;            /* 1 iff reached from start nonterminal */
 
 
        Rule rules;             /* rules w/nonterminal on lhs */
        Rule rules;             /* rules w/nonterminal on lhs */
 
 
        Rule chain;             /* chain rules w/nonterminal on rhs */
        Rule chain;             /* chain rules w/nonterminal on rhs */
 
 
        Nonterm link;           /* next terminal in number order */
        Nonterm link;           /* next terminal in number order */
 
 
};
};
 
 
extern Nonterm nonterm(char *id);
extern Nonterm nonterm(char *id);
 
 
extern Term term(char *id, int esn);
extern Term term(char *id, int esn);
 
 
 
 
 
 
typedef struct tree *Tree;
typedef struct tree *Tree;
 
 
struct tree {           /* tree patterns: */
struct tree {           /* tree patterns: */
 
 
        void *op;               /* a terminal or nonterminal */
        void *op;               /* a terminal or nonterminal */
 
 
        Tree left, right;       /* operands */
        Tree left, right;       /* operands */
 
 
        int nterms;             /* number of terminal nodes in this tree */
        int nterms;             /* number of terminal nodes in this tree */
 
 
};
};
 
 
extern Tree tree(char *op, Tree left, Tree right);
extern Tree tree(char *op, Tree left, Tree right);
 
 
 
 
 
 
struct rule {           /* rules: */
struct rule {           /* rules: */
 
 
        Nonterm lhs;            /* lefthand side nonterminal */
        Nonterm lhs;            /* lefthand side nonterminal */
 
 
        Tree pattern;           /* rule pattern */
        Tree pattern;           /* rule pattern */
 
 
        int ern;                /* external rule number */
        int ern;                /* external rule number */
 
 
        int packed;             /* packed external rule number */
        int packed;             /* packed external rule number */
 
 
        int cost;               /* cost, if a constant */
        int cost;               /* cost, if a constant */
 
 
        char *code;             /* cost, if an expression */
        char *code;             /* cost, if an expression */
 
 
        char *template;         /* assembler template */
        char *template;         /* assembler template */
 
 
        Rule link;              /* next rule in ern order */
        Rule link;              /* next rule in ern order */
 
 
        Rule next;              /* next rule with same pattern root */
        Rule next;              /* next rule with same pattern root */
 
 
        Rule chain;             /* next chain rule with same rhs */
        Rule chain;             /* next chain rule with same rhs */
 
 
        Rule decode;            /* next rule with same lhs */
        Rule decode;            /* next rule with same lhs */
 
 
        Rule kids;              /* next rule with same _kids pattern */
        Rule kids;              /* next rule with same _kids pattern */
 
 
};
};
 
 
extern Rule rule(char *id, Tree pattern, char *template, char *code);
extern Rule rule(char *id, Tree pattern, char *template, char *code);
 
 
 
 
 
 
/* gram.y: */
/* gram.y: */
 
 
void yyerror(char *fmt, ...);
void yyerror(char *fmt, ...);
 
 
int yyparse(void);
int yyparse(void);
 
 
void yywarn(char *fmt, ...);
void yywarn(char *fmt, ...);
 
 
extern int errcnt;
extern int errcnt;
 
 
extern FILE *infp;
extern FILE *infp;
 
 
extern FILE *outfp;
extern FILE *outfp;
 
 
 
 
 
 
#endif
#endif
 
 
 
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.