blob: e42f761947eed4c6d295204373fc7bd005b6b19e (
plain) (
blame)
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
|
#ifndef TREE_H
#define TREE_H
#include <stdlib.h>
typedef struct TREE_STRUC {
enum {
TREE_VAR_DEF,
TREE_VAR,
TREE_FN_DEF,
TREE_FN_CALL,
TREE_STR,
TREE_SUBTREE,
} type;
union tree_union {
struct var_def_struc {
char* name;
struct TREE_STRUC* val;
int* is_const;
} var_def;
struct var_struc {
char* name;
} var;
struct fn_def_struc {
char* name;
struct TREE_STRUC** val;
struct TREE_STRUC** argv;
size_t argsize;
} fn_def;
struct fn_call_struc {
char* name;
struct TREE_STRUC** argv;
size_t argsize;
} fn_call;
struct str_struc {
char* val;
} str;
struct subtree_struc {
struct TREE_STRUC** val;
size_t size;
} subtree;
} data;
} tree_t;
tree_t* tree_init(int type);
#endif
|