diff options
Diffstat (limited to 'ast.h')
| -rw-r--r-- | ast.h | 57 |
1 files changed, 42 insertions, 15 deletions
@@ -5,7 +5,19 @@ struct stmt_node; struct expr_node; struct type_node { - char* type; + bool _unsigned; + bool _short; + bool _long; + unsigned char ptr_level; + char* name; +}; + +struct int_lit_node { + long long val; +}; + +struct var_ref_node { + char* ident; }; struct var_decl_node { @@ -15,6 +27,35 @@ struct var_decl_node { struct var_decl_node* next; }; +struct lval_node { + enum { + LVAL_VAR_DECL, + LVAL_VAR_USE, + } type; + union { + struct var_ref_node _var_ref; + struct var_decl_node _var_decl; + } as; +}; + +/* TODO: add to expression, parse */ +struct assign_node { + struct lval_node lval; + struct expr_node* rval; +}; + +struct expr_node { + enum { + EXPR_EMPTY, + EXPR_INT_LIT, + EXPR_VAR_REF, + } type; + union { + struct int_lit_node _int_lit; + struct var_ref_node _var_ref; + } as; +}; + struct group_node { struct stmt_node* body_head; }; @@ -30,20 +71,6 @@ struct return_node { struct expr_node* ret_val; /* null to return void */ }; -struct int_lit_node { - long long val; -}; - -struct expr_node { - enum { - EXPR_EMPTY, - EXPR_INT_LIT, - } type; - union { - struct int_lit_node _int_lit; - } as; -}; - struct stmt_node { enum { STMT_EXPR, |
