aboutsummaryrefslogtreecommitdiff
path: root/parser.h
diff options
context:
space:
mode:
authorAryadev Chavali <aryadev@aryadevchavali.com>2023-09-02 16:14:49 +0100
committerAryadev Chavali <aryadev@aryadevchavali.com>2023-09-02 16:14:49 +0100
commite5cba43a0e5a19360d87594ae22cdb94872e536c (patch)
tree8e2477ab3a5684f5ad0cab8ec5a5d65603afeb74 /parser.h
parentc9b6b04d190c1f9d0c4dfd7c4e66ac0743be18fd (diff)
downloadobf-e5cba43a0e5a19360d87594ae22cdb94872e536c.tar.gz
obf-e5cba43a0e5a19360d87594ae22cdb94872e536c.tar.bz2
obf-e5cba43a0e5a19360d87594ae22cdb94872e536c.zip
New module for parser functions
Same principle as main->lib (previous commit).
Diffstat (limited to 'parser.h')
-rw-r--r--parser.h32
1 files changed, 32 insertions, 0 deletions
diff --git a/parser.h b/parser.h
new file mode 100644
index 0000000..70ed4ff
--- /dev/null
+++ b/parser.h
@@ -0,0 +1,32 @@
+#ifndef PARSER_H
+#define PARSER_H
+
+#include "./lib.h"
+
+typedef struct AST
+{
+ size_t col, row;
+ enum
+ {
+ NEXT = 0,
+ PREV,
+ INC,
+ DEC,
+ OUT,
+ READ,
+ LIN,
+ LOUT
+ } type;
+ int loop_ref;
+} node_t;
+
+struct PResult
+{
+ node_t *nodes;
+ size_t size;
+};
+
+char *ast_to_str(node_t *ast, size_t size);
+struct PResult parse_buffer(buffer_t *buffer);
+
+#endif