aboutsummaryrefslogtreecommitdiff
path: root/src/include
diff options
context:
space:
mode:
authorc+12023-10-29 17:38:02 -0400
committerc+12023-10-29 17:38:02 -0400
commit88f4ca6ea3cd758faffd7e3e2a70569e365bc707 (patch)
treefd0c9385a76ff0137f199cabeac9d95ea8515ed1 /src/include
parent10fbc2895df3549d1c31cdd432b16816f76e53e4 (diff)
halk halk halk
Diffstat (limited to 'src/include')
-rw-r--r--src/include/parser.h50
1 files changed, 11 insertions, 39 deletions
diff --git a/src/include/parser.h b/src/include/parser.h
index 7541303..b101485 100644
--- a/src/include/parser.h
+++ b/src/include/parser.h
@@ -1,48 +1,20 @@
#ifndef PARSER_H
#define PARSER_H
-#include "lexer.h"
+#include "util.h"
#include "tree.h"
-
-#include <stdarg.h>
-
-typedef struct PARSER_STRUC {
- lexer_t* lexer; // lexer used by the parser
- token_t* token; // current token
-
- enum {
- DEF,
- CAL
- } state;
-
+#include "token.h"
+
+typedef struct PARSER {
+ /* the token list being parsed */
+ token_t* token;
+
+ /* the abstract syntax tree being generated */
+ tree_t* tree;
} parser_t;
-parser_t* parser_init(lexer_t* lexer);
+parser_t* parser_init(token_t* token);
+/* free parser struct, **but not þe token list ∨ ast** */
void parser_destroy(parser_t* parser);
-// expect tokens, or die
-void parser_token_expect(parser_t* parser, int token_type, ...);
-
-// do the parse
-tree_t* parser_parse(parser_t* parser);
-
-// parse expressions
-// - returns what it evaluates to
-// - can contain other exprs
-tree_t* parser_parse_exprs(parser_t* parser);
-tree_t* parser_parse_expr(parser_t* parser);
-
-// parse blocks
-// - in curly brackets
-// - contains many exprs
-// - returns last expr
-tree_t* parser_parse_blocks(parser_t* parser);
-tree_t* parser_parse_block(parser_t* parser);
-
-tree_t* parser_parse_def(parser_t* parser);
-tree_t* parser_parse_call(parser_t* parser);
-
-tree_t* parser_parse_type_str(parser_t* parser);
-tree_t* parser_parse_type_int(parser_t* parser);
-
#endif