diff options
author | kartofen <mladenovnasko0@gmail.com> | 2024-01-02 16:06:45 +0200 |
---|---|---|
committer | kartofen <mladenovnasko0@gmail.com> | 2024-01-02 16:06:45 +0200 |
commit | c837b2bb4ea71cedb434260b11c9f356e8b34e2d (patch) | |
tree | d8d0b5bc5e6831b75e0d71395326e0e206c1bf43 /src/parser.h | |
parent | 536f787c627e3a2b245e529345b948dc4631817f (diff) |
things
Diffstat (limited to 'src/parser.h')
-rw-r--r-- | src/parser.h | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/parser.h b/src/parser.h index 8fc5d6c..9193ca1 100644 --- a/src/parser.h +++ b/src/parser.h @@ -5,6 +5,7 @@ #include "lexer.h" typedef struct parser *parser_t; +typedef struct ast ast_t; struct ast { enum ast_type { @@ -26,7 +27,6 @@ struct ast { }; struct parser { - struct sexp root; struct sexp *cur_sexp; struct quote_node { @@ -45,16 +45,16 @@ parser_t parser_create(); // deallocate a parser void parser_destroy(parser_t parser); -// reset a parser to its default state without destroying it +// reset to its default state without destroying it // returns 0 on success void parser_reset(parser_t parser); +void ast_reset(ast_t *ast_root); // self explanatory -void parser_print_ast(parser_t parser); +void ast_print(ast_t *ast_root); -// turn the given lexer (which has already has tokens) into an ast -// returns 0 on success, > 0 when more tokens are needed, -// and < 0 on a fatal error -int parser_parse_lexer(parser_t parser, lexer_t lexer); +// turn the given toklist into an ast +// returns 0 on success, and < 0 on a fatal error +int parser_parse_toklist(parser_t parser, toklist_t *tokens, ast_t *ast); #endif |