]> mj.ucw.cz Git - umpf.git/blob - brum.h
NUM token is dead
[umpf.git] / brum.h
1 /* cond.h */
2 int yylex (void);
3 void yyerror (char const *);
4
5 struct tree {
6         enum {
7                 ST_IF,
8                 ST_COND,
9                 ST_BLOCK,
10                 ST_ASS,
11                 ST_LEAF,
12                 ST_EMPTY,
13                 ST_ARROW,
14                 ST_OP
15         } st;   /* subtree type */
16         union {
17                 struct {
18                         struct tree* c; /* condition */
19                         struct tree* i; /* if */
20                         struct tree* e; /* else */
21                 } tif;
22
23                 struct {
24                         int op;
25                         struct tree* left;
26                         struct tree* right;
27                 } cond; /* binary operator */
28
29                 struct {
30                         struct tree* head;
31                         struct tree* tail;
32                 } block;
33
34                 struct {
35                         struct tree* left;
36                         struct tree* right;
37                 } ass;
38
39                 struct {
40                         enum {
41                                 L_VAR,
42                                 L_CONST,
43                         } type;
44                         char* value;
45                 } leaf;
46
47                 struct {
48                         char* kw_left;
49                         char* kw_right; 
50                         struct tree* s;
51                 } arrow;
52
53                 struct {
54                         int op;
55                         struct tree* left;
56                         struct tree* right;
57                 } op;
58
59         } pt;
60 };
61
62 struct tree* input_tree;
63
64 /* lex.c */
65 void* xmalloc(size_t size);
66 char* xstrdup(char* s);
67 int line;
68
69 /* int.c */
70 void print_tree(struct tree* t, int ind);
71 void interp(struct tree* t);
72 struct variable** new_var_hash(void);
73
74 struct variable** var_hash;