diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/include/tree.h | 68 |
1 files changed, 14 insertions, 54 deletions
diff --git a/src/include/tree.h b/src/include/tree.h index c35c694..06f4ee3 100644 --- a/src/include/tree.h +++ b/src/include/tree.h @@ -3,66 +3,26 @@ #include <stdlib.h> - -typedef struct PRIM_STRUC { - int is_mutable; - enum { - STR, - INT, - UNKWN, - } type; - - union prim_union { - struct str_struc { - unsigned int* len; - char* val; - } prim_str; - - struct int_struc { - int* val; - } prim_int; - - struct unkwn_struc { - void* val; - } prim_unkwn; - } val; -} prim_t; - typedef struct TREE_STRUC { enum { - TREE_PRIM, - TREE_SUBTREE, TREE_DEF, TREE_CALL, + TREE_STRING, + TREE_INT, } type; - union tree_union { - - struct prim_struc { - prim_t* val; - } prim; - - struct subtree_struc { - struct TREE_STRUC** val; - size_t size; - } subtree; - - struct def_struc { - char* name; - prim_t** args; - struct subtree_struc** val; - } def; - - struct call_struc { - char* name; - prim_t** args; - } call; - - } oftype; + union { + struct def { + char* name; // name of definition + int mutability; // mutability of definition + struct TREE_STRUC* value; // value of definition + }; + + struct call { + char* target; // name of definition being called + struct TREE_STRUC** args; // arguments passed to definition + }; + } data; } tree_t; -prim_t* prim_init(int type); -tree_t* tree_init(int type); - - #endif |