summaryrefslogtreecommitdiff
path: root/parser.h
diff options
context:
space:
mode:
Diffstat (limited to 'parser.h')
-rw-r--r--parser.h29
1 files changed, 29 insertions, 0 deletions
diff --git a/parser.h b/parser.h
new file mode 100644
index 0000000..4c750cf
--- /dev/null
+++ b/parser.h
@@ -0,0 +1,29 @@
+#ifndef PARSER_H
+#define PARSER_H
+
+#include <stdint.h>
+#include <stddef.h>
+
+typedef enum {
+ NODE_START,
+ NODE_RETURN,
+ NODE_CONST,
+} node_type;
+
+typedef struct _node {
+ union {
+ uint64_t integer;
+ double flt;
+ } data;
+
+ node_type type;
+ struct _node **children;
+ size_t children_length;
+ size_t children_size;
+ size_t id;
+} node;
+
+void add_child(node *n, node *child);
+node *ir_parse(token *tokens);
+
+#endif