diff options
author | ubq323 <ubq323@ubq323.website> | 2023-07-10 21:35:02 +0100 |
---|---|---|
committer | ubq323 <ubq323@ubq323.website> | 2023-07-10 21:35:02 +0100 |
commit | 86c9a7e5c47c5c3eb70e06ea5e278de8022fd5b2 (patch) | |
tree | 4417af653c8619475ff818705760feb6edb83757 /ast.c | |
parent | d28f04f44efffd61564951456c061ba14e1921eb (diff) |
minor
Diffstat (limited to 'ast.c')
-rw-r--r-- | ast.c | 10 |
1 files changed, 7 insertions, 3 deletions
@@ -2,6 +2,7 @@ #include <stdlib.h> #include <stddef.h> #include <stdio.h> +#include <assert.h> AstVec astvec_new() { AstNode *vals = malloc(2 * sizeof(AstNode)); @@ -23,6 +24,12 @@ void astvec_append(AstVec *v, AstNode val) { v->len ++; } +void astnode_append(AstNode *l, AstNode val) { + printf(" astnode_append: %d\n",l->ty); + assert(l->ty == AST_LIST); + astvec_append(&l->as.list, val); +} + AstNode astnode_new_num(int n) { return (AstNode){ .ty = AST_NUM, @@ -41,6 +48,3 @@ AstNode astnode_new_list() { }; } - - - |