aboutsummaryrefslogtreecommitdiffstats
path: root/src/nodes.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/nodes.h')
-rw-r--r--src/nodes.h45
1 files changed, 45 insertions, 0 deletions
diff --git a/src/nodes.h b/src/nodes.h
new file mode 100644
index 0000000..e6ceb50
--- /dev/null
+++ b/src/nodes.h
@@ -0,0 +1,45 @@
1#ifndef BDL_NODES_H
2#define BDL_NODES_H
3
4typedef enum NodeType {
5 NODE_BUILTIN,
6 NODE_NUMBER,
7 NODE_BOOL,
8 NODE_STRING,
9 NODE_SYMBOL,
10 NODE_DEF,
11} NodeType;
12
13typedef struct Node {
14 NodeType type;
15
16 union {
17 // Numbers.
18 struct {
19 bool negative;
20 size_t integral;
21 size_t fractional;
22 } number;
23
24 // String/symbol.
25 StringView string;
26
27 // Boolean.
28 bool boolean;
29
30 // Builtin primitive.
31 struct {
32 TokenType type;
33 struct Node **args;
34 } builtin;
35
36 // Variable definition.
37 struct {
38 struct Node *symbol;
39 struct Node *value;
40 StringView type;
41 } def;
42 };
43} Node;
44
45#endif // BDL_NODES_H