1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
typedef struct {
enum {
/* Top Level */
PROG = 1024, FUNC_DEF, PARAMS,
DECL, /* declaration */
DECLR, /* declarator */
DECLRS,
INIT_DECLRS, INIT_DECLR,
INITR, /* initializer */
TYPE_SPEC,
STRUCT, UNION,
PLAIN_DECL, PLAIN_DECLR,
/* Statments */
EXP_STMT, /* expression-statment */
COMP_STMT, IF_STMT, /* selection-statment */
WHILE_STMT, FOR_STMT,
CONT_STMT , BREAK_STMT, RET_STMT, /* 'continue', 'break', 'return' */
/* Expressions (expressions use their token ID to denote their types */
EXP
} type;
union {
int intval;
char *strvar;
} rec;
struct CNode *chd, *next;
/* For error reporting */
struct Location {
int row, col;
} loc;
} CNode;
|