hachem.wtf
aboutsummaryrefslogtreecommitdiff
path: root/ast.h
diff options
context:
space:
mode:
authorhachem <im@hachem.wtf>2026-09-19 11:01:51 +0200
committerhachem <im@hachem.wtf>2026-09-19 11:01:51 +0200
commit08b8cbbccd8c8d7dab75746ee9d134f67455de91 (patch)
tree83de1ed169e14b2595cd9da9e5c16f1d84c8c808 /ast.h
parent05bf718e37efdc5201ad281e85da7850af31bd59 (diff)
feat: start work on ast
Diffstat (limited to 'ast.h')
-rw-r--r--ast.h27
1 files changed, 27 insertions, 0 deletions
diff --git a/ast.h b/ast.h
new file mode 100644
index 0000000..1a6f159
--- /dev/null
+++ b/ast.h
@@ -0,0 +1,27 @@
+#pragma once
+
+enum NodeKind
+{
+ NODE_CHAR,
+ TYPE_DECLTYPE,
+ VALUE_DIFFERENCE,
+ STMT_EMIT
+};
+
+struct Node
+{
+ enum NodeKind kind;
+ int line;
+ char character;
+ struct Node* first;
+ struct Node* second;
+ struct Node* next;
+};
+
+struct Node* node_leaf(enum NodeKind kind);
+struct Node* node_char(char character);
+struct Node* node_unary(enum NodeKind kind, struct Node* first);
+struct Node* node_binary(enum NodeKind kind, struct Node* first, struct Node* second);
+
+struct Node* node_append(struct Node* list, struct Node* node);
+void node_free(struct Node* node);