From b2c539fadfa7ea3eea2e5f7c0c37b5f5f1370c5a Mon Sep 17 00:00:00 2001 From: Preston Pan Date: Tue, 3 Jan 2023 09:45:40 -0800 Subject: actually evaluates and prints something now! --- src/include/ast.h | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'src/include/ast.h') diff --git a/src/include/ast.h b/src/include/ast.h index ca07c9d..a5095e1 100644 --- a/src/include/ast.h +++ b/src/include/ast.h @@ -4,6 +4,8 @@ typedef struct AST_STRUCT { enum { + /* root node */ + AST_ROOT, /* complex types */ AST_PAIR, AST_SYMBOL, @@ -14,9 +16,12 @@ typedef struct AST_STRUCT { AST_FLOAT, AST_FUNCTION, } type; + /* we need to know the amount of expressions in the root node */ + int root_size; + struct AST_STRUCT **subnodes; /* For functions, the car will be a list of variables, and the cdr will be the - * expression */ + * expression. */ int argument_number; /* number of arguments that function accepts. Used for speeding up stuff. */ struct AST_STRUCT *car; @@ -43,4 +48,6 @@ ast_t *init_ast_bool(bool value); ast_t *init_ast_symbol(char *value); ast_t *init_ast_function(ast_t *car, ast_t *cdr); + +ast_t *init_ast_root(ast_t **subnodes, int size); #endif -- cgit