blob: e6ceb5055489c7365cca8d05f812c8ed09bc7ce5 (
plain)
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
|
#ifndef BDL_NODES_H
#define BDL_NODES_H
typedef enum NodeType {
NODE_BUILTIN,
NODE_NUMBER,
NODE_BOOL,
NODE_STRING,
NODE_SYMBOL,
NODE_DEF,
} NodeType;
typedef struct Node {
NodeType type;
union {
// Numbers.
struct {
bool negative;
size_t integral;
size_t fractional;
} number;
// String/symbol.
StringView string;
// Boolean.
bool boolean;
// Builtin primitive.
struct {
TokenType type;
struct Node **args;
} builtin;
// Variable definition.
struct {
struct Node *symbol;
struct Node *value;
StringView type;
} def;
};
} Node;
#endif // BDL_NODES_H
|