diff options
Diffstat (limited to 'src/nodes.h')
-rw-r--r-- | src/nodes.h | 88 |
1 files changed, 0 insertions, 88 deletions
diff --git a/src/nodes.h b/src/nodes.h deleted file mode 100644 index af10573..0000000 --- a/src/nodes.h +++ /dev/null | |||
@@ -1,88 +0,0 @@ | |||
1 | #ifndef BDL_NODES_H | ||
2 | #define BDL_NODES_H | ||
3 | |||
4 | typedef enum NodeType { | ||
5 | NODE_BUILTIN, | ||
6 | NODE_NUMBER, | ||
7 | NODE_BOOL, | ||
8 | NODE_STRING, | ||
9 | NODE_SYMBOL, | ||
10 | NODE_TYPE, | ||
11 | NODE_DEF, | ||
12 | NODE_SET, | ||
13 | NODE_FUN, | ||
14 | NODE_BLOCK, | ||
15 | NODE_IF, | ||
16 | NODE_FUNCALL, | ||
17 | } NodeType; | ||
18 | |||
19 | typedef struct Node { | ||
20 | size_t id; | ||
21 | NodeType type; | ||
22 | size_t line; | ||
23 | size_t col; | ||
24 | struct Type *expr_type; | ||
25 | |||
26 | union { | ||
27 | // Numbers. | ||
28 | struct { | ||
29 | bool negative; | ||
30 | size_t integral; | ||
31 | size_t fractional; | ||
32 | } number; | ||
33 | |||
34 | // String/symbol/type. | ||
35 | StringView string; | ||
36 | |||
37 | // Boolean. | ||
38 | bool boolean; | ||
39 | |||
40 | // Builtin primitive. | ||
41 | struct { | ||
42 | TokenType type; | ||
43 | struct Node **args; | ||
44 | } builtin; | ||
45 | |||
46 | // Function call. | ||
47 | struct { | ||
48 | struct Node *name; | ||
49 | struct Node **args; | ||
50 | } funcall; | ||
51 | |||
52 | // Variable definition. | ||
53 | struct { | ||
54 | struct Node *symbol; | ||
55 | struct Node *value; | ||
56 | struct Node *type; | ||
57 | } def; | ||
58 | |||
59 | // Variable assignment. | ||
60 | struct { | ||
61 | struct Node *symbol; | ||
62 | struct Node *value; | ||
63 | } set; | ||
64 | |||
65 | // Function definition. | ||
66 | struct { | ||
67 | struct Node *name; | ||
68 | struct Node **param_names; | ||
69 | struct Node **param_types; | ||
70 | struct Node *return_type; | ||
71 | struct Node *body; | ||
72 | } fun; | ||
73 | |||
74 | // Block statements. | ||
75 | struct { | ||
76 | struct Node **expr; | ||
77 | } block; | ||
78 | |||
79 | // If statement. | ||
80 | struct { | ||
81 | struct Node *cond; | ||
82 | struct Node *expr_true; | ||
83 | struct Node *expr_false; | ||
84 | } ifexpr; | ||
85 | }; | ||
86 | } Node; | ||
87 | |||
88 | #endif // BDL_NODES_H | ||