diff options
Diffstat (limited to 'inc/treeify.h')
-rw-r--r-- | inc/treeify.h | 27 |
1 files changed, 16 insertions, 11 deletions
diff --git a/inc/treeify.h b/inc/treeify.h index 3af67f8..bc8a64d 100644 --- a/inc/treeify.h +++ b/inc/treeify.h @@ -15,13 +15,20 @@ enum node_type { // (*f* x y) struct node_expression_identifier { ctx_string name; // f - ctx_string type; // u32 }; -// (f *x* *y*) +enum node_expression_parameter_type { + PARAM_TYPE_IDENT, + PARAM_TYPE_EXPRESSION, +}; + +// (f *x* *y* *(expr)*) struct node_expression_parameter { - ctx_string name; // x or y - ctx_string type; // u32 + enum node_expression_parameter_type type; + union { + ctx_string name; // x or y + struct node_expression *expression; // (expr) + } data; }; // *(f x y)* @@ -55,16 +62,14 @@ struct node_declaration { struct node { enum node_type type; - /* struct node *next; */ + struct node *prev; + struct node *next; void *data; }; -struct tree { - struct node *node; -}; - -struct tree *tree_create(void); -void tree_destroy(struct tree *tree); +struct node *tree_create(void); +void tree_destroy(struct node *tree); +void tree_add(struct ctx *ctx, enum node_type type, void *data); void treeify(struct ctx *ctx); |