Implemented groupings

This commit is contained in:
2022-08-07 15:04:19 +01:00
parent d7fda480fd
commit 9a415738d9
9 changed files with 124 additions and 21 deletions

View File

@@ -11,7 +11,7 @@ typedef enum NodeType {
NODE_LITERAL, //a simple value
NODE_UNARY, //one child
NODE_BINARY, //two children, left and right
// NODE_GROUPING,
NODE_GROUPING, //one child
} NodeType;
typedef struct NodeLiteral {
@@ -32,11 +32,17 @@ typedef struct NodeBinary {
Node* right;
} NodeBinary;
typedef struct NodeGrouping {
NodeType type;
Node* child;
} NodeGrouping;
union _node {
NodeType type;
NodeLiteral atomic;
NodeUnary unary;
NodeBinary binary;
NodeGrouping grouping;
};
void freeNode(Node* node);