diff options
author | Camil Staps | 2016-09-24 10:22:53 +0200 |
---|---|---|
committer | Camil Staps | 2016-09-24 10:22:53 +0200 |
commit | 314bcfc67fb95df06c8177cab8792b46b25d90fc (patch) | |
tree | a8b8a37b53938758378690ae2842f793eddaa262 /interpreter/graphs.h | |
parent | Fix one memory leak mentioned in #2; add debug dot graphs output (diff) |
Working graphs (?)
Diffstat (limited to 'interpreter/graphs.h')
-rw-r--r-- | interpreter/graphs.h | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/interpreter/graphs.h b/interpreter/graphs.h index f127642..fcb314e 100644 --- a/interpreter/graphs.h +++ b/interpreter/graphs.h @@ -3,23 +3,25 @@ #include "syntax.h" +typedef enum { + NODE_INT, /* See expr_kind in syntax.h */ + NODE_NAME, + NODE_CODE, + NODE_LIST, + NODE_TUPLE, + NODE_APP, +} node_kind; + struct node { - expr_kind kind; + node_kind kind; void* var1; void* var2; unsigned int used_count; }; -typedef struct { - unsigned int length; - struct node* nodes[1]; -} nodes_array; - void use_node(struct node* node, unsigned int count); void free_node(struct node* node, unsigned int count, unsigned free_first); -nodes_array* push_node(nodes_array* nodes, struct node* node); - void cpy_expression_to_node(struct node* dst, expression* src); void cpy_node_to_expression(expression* dst, struct node* src); |