#ifndef _ast_h #define _ast_h #include #include typedef enum { AST_LIST, AST_NUM, AST_SYMBOL, } AstTy; struct _astnode; typedef struct _astnode AstNode; typedef struct { size_t len; size_t cap; AstNode *vals; } AstVec; struct _astnode { AstTy ty; union { int num; AstVec list; char *str; } as; }; AstVec astvec_new(); void astvec_append(AstVec *v, AstNode val); void astnode_append(AstNode *l, AstNode val); AstNode astnode_new_num(int n); AstNode astnode_new_list(); AstNode astnode_new_symbol(char *s); void astnode_disp(AstNode *a); #endif