aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authors-over-42023-06-23 00:49:39 -0400
committers-over-42023-06-23 00:49:39 -0400
commit0bc9c5bd16475f0d855e5929ea39b2f601564556 (patch)
tree5fc02b72848ea0792a9926ab0c08fd4c1eae4a3d
parent43405e591e6330939b84548c50bb537a87232838 (diff)
begin work on parser
-rw-r--r--src/include/tree.h68
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