aboutsummaryrefslogtreecommitdiff
path: root/inc/treeify.h
diff options
context:
space:
mode:
Diffstat (limited to 'inc/treeify.h')
-rw-r--r--inc/treeify.h37
1 files changed, 30 insertions, 7 deletions
diff --git a/inc/treeify.h b/inc/treeify.h
index bc8a64d..1e2d3e5 100644
--- a/inc/treeify.h
+++ b/inc/treeify.h
@@ -6,6 +6,7 @@
enum node_type {
EXPRESSION,
DECLARATION,
+ DEFINITION,
};
/**
@@ -31,33 +32,55 @@ struct node_expression_parameter {
} data;
};
-// *(f x y)*
+// (*f x y*)
struct node_expression {
struct node_expression_identifier *callee; // f
struct node_expression_parameter *parameters; // x y
+ size_t parameter_count;
};
/**
* Declarations
*/
-// *u32:f* u32:x u32:y = (...)
+// *f* u32 u32 -> *u32*
struct node_declaration_callee {
ctx_string name; // f
ctx_string type; // u32
};
-// u32:f *u32:x* *u32:y* = (...)
+// f *u32* *u32* -> u32
struct node_declaration_parameter {
- ctx_string name; // x or y
ctx_string type; // u32
};
-// *u32:f u32:x u32:y* = (...) OR
-// *u32:a* = ...
+// *f u32 u32 -> u32*
struct node_declaration {
struct node_declaration_callee callee; // f
- struct node_declaration_parameter *parameters; // x y OR NULL
+ struct node_declaration_parameter *parameters; // u32 u32 OR NULL
+ size_t parameter_count;
+};
+
+/**
+ * Definitions
+ */
+
+// *f* a b : expr
+struct node_definition_callee {
+ ctx_string name;
+};
+
+// f *a* *b* : expr
+struct node_definition_parameter {
+ ctx_string name; // u32
+};
+
+// *f a b : expr*
+struct node_definition {
+ struct node_definition_callee callee; // f
+ struct node_definition_parameter *parameters; // a b
+ size_t parameter_count;
+ struct node_expression expression; // expr
};
struct node {