summaryrefslogtreecommitdiff
path: root/src/include/ast.h
diff options
context:
space:
mode:
authorPreston Pan <preston@nullring.xyz>2023-01-03 09:45:40 -0800
committerPreston Pan <preston@nullring.xyz>2023-01-03 09:45:40 -0800
commitb2c539fadfa7ea3eea2e5f7c0c37b5f5f1370c5a (patch)
tree0f4b9db8c6bf345c9011667c9fbb61393d93a347 /src/include/ast.h
parent9f342255a2260480701cc2ac2d0c623d4aba1348 (diff)
actually evaluates and prints something now!
Diffstat (limited to 'src/include/ast.h')
-rw-r--r--src/include/ast.h9
1 files changed, 8 insertions, 1 deletions
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