From c837b2bb4ea71cedb434260b11c9f356e8b34e2d Mon Sep 17 00:00:00 2001 From: kartofen Date: Tue, 2 Jan 2024 16:06:45 +0200 Subject: things --- src/parser.h | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'src/parser.h') 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 -- cgit v1.2.3