From e5cba43a0e5a19360d87594ae22cdb94872e536c Mon Sep 17 00:00:00 2001 From: Aryadev Chavali Date: Sat, 2 Sep 2023 16:14:49 +0100 Subject: New module for parser functions Same principle as main->lib (previous commit). --- parser.h | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 parser.h (limited to 'parser.h') 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 -- cgit v1.2.3-13-gbd6f