#ifndef BDL_NODES_H #define BDL_NODES_H typedef enum NodeType { NODE_BUILTIN, NODE_NUMBER, NODE_BOOL, NODE_STRING, NODE_SYMBOL, NODE_TYPE, NODE_DEF, NODE_SET, NODE_FUN, } 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; struct Node *type; } def; // Variable assignment. struct { struct Node *symbol; struct Node *value; } set; // Function definition. struct { struct Node *name; struct Node **param_names; struct Node **param_types; struct Node *return_type; struct Node **body; } fun; }; } Node; #endif // BDL_NODES_H