Guido van Rossum | 85a5fbb | 1990-10-14 12:07:46 +0000 | [diff] [blame] | 1 | /* Parser interface */ |
| 2 | |
| 3 | #define MAXSTACK 100 |
| 4 | |
| 5 | typedef struct _stackentry { |
| 6 | int s_state; /* State in current DFA */ |
| 7 | dfa *s_dfa; /* Current DFA */ |
Guido van Rossum | 3f5da24 | 1990-12-20 15:06:42 +0000 | [diff] [blame] | 8 | struct _node *s_parent; /* Where to add next node */ |
Guido van Rossum | 85a5fbb | 1990-10-14 12:07:46 +0000 | [diff] [blame] | 9 | } stackentry; |
| 10 | |
| 11 | typedef struct _stack { |
| 12 | stackentry *s_top; /* Top entry */ |
| 13 | stackentry s_base[MAXSTACK];/* Array of stack entries */ |
| 14 | /* NB The stack grows down */ |
| 15 | } stack; |
| 16 | |
| 17 | typedef struct { |
| 18 | struct _stack p_stack; /* Stack of parser states */ |
| 19 | struct _grammar *p_grammar; /* Grammar to use */ |
| 20 | struct _node *p_tree; /* Top of parse tree */ |
| 21 | } parser_state; |
| 22 | |
| 23 | parser_state *newparser PROTO((struct _grammar *g, int start)); |
| 24 | void delparser PROTO((parser_state *ps)); |
Guido van Rossum | 3f5da24 | 1990-12-20 15:06:42 +0000 | [diff] [blame] | 25 | int addtoken PROTO((parser_state *ps, int type, char *str, int lineno)); |
| 26 | void addaccelerators PROTO((grammar *g)); |