From 76e952ec1756deae78d9a88a67b97eff3550959e Mon Sep 17 00:00:00 2001 From: s-over-4 Date: Fri, 23 Jun 2023 01:07:48 -0400 Subject: basic tree init/destroy --- src/include/tree.h | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) (limited to 'src/include') diff --git a/src/include/tree.h b/src/include/tree.h index 06f4ee3..4ffefcf 100644 --- a/src/include/tree.h +++ b/src/include/tree.h @@ -7,22 +7,35 @@ typedef struct TREE_STRUC { enum { TREE_DEF, TREE_CALL, - TREE_STRING, - TREE_INT, + TREE_TYPE_STR, + TREE_TYPE_INT, } type; union { - struct def { + struct { // === DEFINITIONS === char* name; // name of definition int mutability; // mutability of definition struct TREE_STRUC* value; // value of definition - }; + } def; - struct call { + struct { // === CALLS === char* target; // name of definition being called struct TREE_STRUC** args; // arguments passed to definition - }; + size_t args_size; // size of arguments + } call; + + // === TYPES === + struct { // strings + char* value; + } type_str; + + struct { // integers + int* value; + } type_int; } data; } tree_t; +tree_t* tree_init(int type); +void tree_destroy(tree_t*); + #endif -- cgit v1.2.3