From 38942c34a497a4c6edf080dc64440c1bc486fc46 Mon Sep 17 00:00:00 2001 From: Elis Eriksson Date: Sat, 20 Jun 2026 20:12:29 +0200 Subject: Pattern matching optimizer and more it's not the best optimizer but it works. Also added a -ast_dump flag which dumps the AST to stderr. Also input is now done in raw mode just because it can be. --- src/all.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/all.h') diff --git a/src/all.h b/src/all.h index c5a983c..c35c8b7 100644 --- a/src/all.h +++ b/src/all.h @@ -40,7 +40,8 @@ typedef enum { AST_PTR_DEC, AST_OUT, AST_IN, - AST_LOOP + AST_LOOP, + AST_CLEAR } ast_type_e; struct ast_node { @@ -58,7 +59,9 @@ typedef struct { parser_t parser_init(lexer_t *lx); ast_node_t *parse_program(parser_t *p); +ast_node_t *optimize_ast(ast_node_t *ast); void ast_free(ast_node_t *node); +void ast_dump(ast_node_t *node, int depth); // codegen -- cgit v1.3-7-ge9ab