26 lines
500 B
C
26 lines
500 B
C
enum nodetype {
|
|
NODEIF, NODEELSE, NODEELSIF, NODEWHILE, NODEOP, NODENUM,
|
|
NODEVAR,
|
|
};
|
|
|
|
struct parsenode {
|
|
union {
|
|
const char *var;
|
|
char op;
|
|
} val;
|
|
const char *filename;
|
|
struct parsenode *left, *right;
|
|
int col, line, pos;
|
|
enum nodetype type;
|
|
};
|
|
|
|
struct parsestate {
|
|
struct tokenstate ts;
|
|
struct parsenode *program;
|
|
/* progsz is the total size of program */
|
|
/* progind is the index (where to put the next tree) */
|
|
size_t progsz, progind;
|
|
};
|
|
|
|
extern int parseall(struct parsestate *ps);
|