diff options
Diffstat (limited to 'ast.h')
| -rw-r--r-- | ast.h | 43 |
1 files changed, 21 insertions, 22 deletions
@@ -33,35 +33,23 @@ struct var_ref_node { struct var_decl_node { struct type_ref_node type; struct var_def* def_ref; -}; - -struct lval_node { - enum { - LVAL_VAR_DECL, - LVAL_VAR_REF, - } type; - union { - struct var_ref_node var_ref; - struct var_decl_node var_decl; - } inner; - - const struct type_def* resolved_type; + struct expr_node* initial_value; }; struct assign_node { - struct lval_node lval; + struct expr_node* lval; struct expr_node* rval; }; -struct args_eval_node { +struct expr_list_node { struct expr_node* expr; - struct args_eval_node* next; + struct expr_list_node* next; }; struct call_node { - /* TODO: eventually this could also be a function pointer */ + /* TODO: function pointers */ struct fn_decl_node* called_fn_ref; /* borrowed */ - struct args_eval_node* args; + struct expr_list_node* args; }; struct unary_node { @@ -114,15 +102,15 @@ struct group_node { struct scope* scope; }; -struct args_decl_node { +struct decl_list_node { struct var_decl_node* decl; - struct args_decl_node* next; + struct decl_list_node* next; }; struct fn_decl_node { struct type_ref_node return_type; char* name; - struct args_decl_node* args; + struct decl_list_node* args; struct group_node body; struct scope* scope; @@ -140,8 +128,19 @@ struct if_node { struct scope* scope; }; +struct loop_init_node { + enum { + INIT_EXPR_LIST, + INIT_DECL, + } type; + union { + struct expr_list_node* expr_list; + struct var_decl_node* decl; + }; +}; + struct loop_node { - struct expr_node* init; /* null if absent */ + struct loop_init_node* init; /* null if absent */ struct expr_node* cond; /* null if absent */ struct expr_node* incr; /* null if absent */ struct stmt_node* body; |
