2002-09-17 23:03:30 +00:00
|
|
|
/* $Id$ */
|
|
|
|
|
|
|
|
struct binding {
|
2005-04-22 04:13:13 +00:00
|
|
|
char *name;
|
|
|
|
int opnum;
|
2002-09-17 23:03:30 +00:00
|
|
|
};
|
2005-04-22 04:13:13 +00:00
|
|
|
typedef struct binding *Binding;
|
2002-09-17 23:03:30 +00:00
|
|
|
|
|
|
|
struct arity {
|
2005-04-22 04:13:13 +00:00
|
|
|
int arity;
|
|
|
|
List bindings;
|
2002-09-17 23:03:30 +00:00
|
|
|
};
|
2005-04-22 04:13:13 +00:00
|
|
|
typedef struct arity *Arity;
|
2002-09-17 23:03:30 +00:00
|
|
|
|
|
|
|
struct patternAST {
|
2005-04-22 04:13:13 +00:00
|
|
|
struct symbol *sym;
|
|
|
|
char *op;
|
|
|
|
List children;
|
2002-09-17 23:03:30 +00:00
|
|
|
};
|
2005-04-22 04:13:13 +00:00
|
|
|
typedef struct patternAST *PatternAST;
|
2002-09-17 23:03:30 +00:00
|
|
|
|
|
|
|
struct ruleAST {
|
2005-04-22 04:13:13 +00:00
|
|
|
char *lhs;
|
|
|
|
PatternAST pat;
|
|
|
|
int erulenum;
|
|
|
|
IntList cost;
|
|
|
|
struct rule *rule;
|
|
|
|
struct strTableElement *kids;
|
|
|
|
struct strTableElement *nts;
|
2002-09-17 23:03:30 +00:00
|
|
|
};
|
2005-04-22 04:13:13 +00:00
|
|
|
typedef struct ruleAST *RuleAST;
|
2002-09-17 23:03:30 +00:00
|
|
|
|
|
|
|
typedef enum {
|
2005-04-22 04:13:13 +00:00
|
|
|
UNKNOWN,
|
|
|
|
OPERATOR,
|
|
|
|
NONTERMINAL
|
2002-09-17 23:03:30 +00:00
|
|
|
} TagType;
|
|
|
|
|
|
|
|
struct symbol {
|
2005-04-22 04:13:13 +00:00
|
|
|
char *name;
|
|
|
|
TagType tag;
|
|
|
|
union {
|
|
|
|
NonTerminal nt;
|
|
|
|
Operator op;
|
|
|
|
} u;
|
2002-09-17 23:03:30 +00:00
|
|
|
};
|
2005-04-22 04:13:13 +00:00
|
|
|
typedef struct symbol *Symbol;
|
2002-09-17 23:03:30 +00:00
|
|
|
|
|
|
|
struct strTableElement {
|
2005-04-22 04:13:13 +00:00
|
|
|
char *str;
|
|
|
|
IntList erulenos;
|
|
|
|
char *ename;
|
2002-09-17 23:03:30 +00:00
|
|
|
};
|
2005-04-22 04:13:13 +00:00
|
|
|
typedef struct strTableElement *StrTableElement;
|
2002-09-17 23:03:30 +00:00
|
|
|
|
|
|
|
struct strTable {
|
2005-04-22 04:13:13 +00:00
|
|
|
List elems;
|
2002-09-17 23:03:30 +00:00
|
|
|
};
|
2005-04-22 04:13:13 +00:00
|
|
|
typedef struct strTable *StrTable;
|
2002-09-17 23:03:30 +00:00
|
|
|
|
2003-01-20 06:19:18 +00:00
|
|
|
extern void doGrammarNts ARGS((void));
|
|
|
|
void makeRuleDescArray ARGS((void));
|
|
|
|
void makeDeltaCostArray ARGS((void));
|
|
|
|
void makeStateStringArray ARGS((void));
|
|
|
|
|
2002-09-17 23:03:30 +00:00
|
|
|
extern StrTable newStrTable ARGS((void));
|
|
|
|
extern StrTableElement addString ARGS((StrTable, char *, int, int *));
|
|
|
|
|
|
|
|
extern void doSpec ARGS((List, List));
|
|
|
|
extern Arity newArity ARGS((int, List));
|
|
|
|
extern Binding newBinding ARGS((char *, int));
|
|
|
|
extern PatternAST newPatternAST ARGS((char *, List));
|
|
|
|
extern RuleAST newRuleAST ARGS((char *, PatternAST, int, IntList));
|
|
|
|
extern Symbol enter ARGS((char *, int *));
|
|
|
|
extern Symbol newSymbol ARGS((char *));
|
|
|
|
|
|
|
|
extern void makeDebug ARGS((void));
|
|
|
|
extern void makeSimple ARGS((void));
|
|
|
|
extern void makePlanks ARGS((void));
|
|
|
|
extern void makeOpLabel ARGS((void));
|
|
|
|
extern void makeChild ARGS((void));
|
|
|
|
extern void makeOperators ARGS((void));
|
|
|
|
extern void makeLabel ARGS((void));
|
|
|
|
extern void makeString ARGS((void));
|
|
|
|
extern void makeString ARGS((void));
|
|
|
|
extern void makeReduce ARGS((void));
|
|
|
|
extern void makeRuleTable ARGS((void));
|
|
|
|
extern void makeTables ARGS((void));
|
|
|
|
extern void makeTreecost ARGS((void));
|
|
|
|
extern void makePrint ARGS((void));
|
|
|
|
extern void makeRule ARGS((void));
|
|
|
|
extern void makeNts ARGS((void));
|
|
|
|
extern void makeKids ARGS((void));
|
|
|
|
extern void startBurm ARGS((void));
|
|
|
|
extern void startOptional ARGS((void));
|
|
|
|
extern void makePlankLabel ARGS((void));
|
|
|
|
extern void makeStateLabel ARGS((void));
|
|
|
|
extern void makeStringArray ARGS((void));
|
|
|
|
extern void makeNonterminalArray ARGS((void));
|
|
|
|
extern void makeCostArray ARGS((void));
|
|
|
|
extern void makeLHSmap ARGS((void));
|
|
|
|
extern void makeClosureArray ARGS((void));
|
|
|
|
extern void makeOperatorVector ARGS((void));
|
|
|
|
extern void endOptional ARGS((void));
|
|
|
|
extern void reportDiagnostics ARGS((void));
|
|
|
|
extern void makeNonterminals ARGS((void));
|
|
|
|
extern int opsOfArity ARGS((int));
|
|
|
|
|
|
|
|
extern void yypurge ARGS((void));
|
|
|
|
extern void yyfinished ARGS((void));
|
|
|
|
|
|
|
|
extern void printRepresentative ARGS((FILE *, Item_Set));
|
|
|
|
|
|
|
|
extern void dumpRules ARGS((List));
|
|
|
|
extern void dumpDecls ARGS((List));
|
|
|
|
extern void dumpRuleAST ARGS((RuleAST));
|
|
|
|
extern void dumpPatternAST ARGS((PatternAST));
|
|
|
|
extern void dumpArity ARGS((Arity));
|
|
|
|
extern void dumpBinding ARGS((Binding));
|
|
|
|
extern void dumpStrTable ARGS((StrTable));
|
|
|
|
|
|
|
|
extern int yylex ARGS((void));
|
|
|
|
extern int yyparse ARGS((void));
|
|
|
|
|
2005-04-22 04:13:13 +00:00
|
|
|
extern int max_ruleAST;
|
|
|
|
extern List ruleASTs;
|
2002-09-17 23:03:30 +00:00
|
|
|
|
2005-04-22 04:13:13 +00:00
|
|
|
extern FILE *outfile;
|
2002-09-22 02:40:40 +00:00
|
|
|
extern const char *prefix;
|
2005-04-22 04:13:13 +00:00
|
|
|
extern int trimflag;
|
|
|
|
extern int speedflag;
|
|
|
|
extern int grammarflag;
|