blob: 1ada8ccebfc623ec8ddbfc7e071636c8334d342d [file] [log] [blame]
Guido van Rossum85a5fbb1990-10-14 12:07:46 +00001/* Parser interface */
2
3#define MAXSTACK 100
4
5typedef struct _stackentry {
6 int s_state; /* State in current DFA */
7 dfa *s_dfa; /* Current DFA */
Guido van Rossum3f5da241990-12-20 15:06:42 +00008 struct _node *s_parent; /* Where to add next node */
Guido van Rossum85a5fbb1990-10-14 12:07:46 +00009} stackentry;
10
11typedef 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
17typedef 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
23parser_state *newparser PROTO((struct _grammar *g, int start));
24void delparser PROTO((parser_state *ps));
Guido van Rossum3f5da241990-12-20 15:06:42 +000025int addtoken PROTO((parser_state *ps, int type, char *str, int lineno));
26void addaccelerators PROTO((grammar *g));