diff options
author | Johnny Richard <johnny@johnnyrichard.com> | 2023-04-18 07:13:55 +0200 |
---|---|---|
committer | Carlos Maniero <carlosmaniero@gmail.com> | 2023-04-18 09:54:50 -0300 |
commit | e3761429de464c42cc2798dc858bf6b43883d9dc (patch) | |
tree | 7a0d37205db4aadc6fc079c5474cb3d36fd25328 /src/parser.h | |
parent | bf2bbaf31487a3935f1a27dc51886d6f53c3d73d (diff) |
ast: Create AST visitor to traverse the tree
In the future we want to have the possibility of traverse the tree and
pretty print it or generate binary for other platform like LLVM or
transpile to C.
This solution also implements the gas assembly x86_64 Linux code
generation by using the visitor interface.
Signed-off-by: Johnny Richard <johnny@johnnyrichard.com>
Diffstat (limited to 'src/parser.h')
-rw-r--r-- | src/parser.h | 15 |
1 files changed, 1 insertions, 14 deletions
diff --git a/src/parser.h b/src/parser.h index d44a4df..b846ae1 100644 --- a/src/parser.h +++ b/src/parser.h @@ -17,6 +17,7 @@ #ifndef PARSER_H #define PARSER_H +#include "ast.h" #include "lexer.h" #include "string_view.h" @@ -24,20 +25,6 @@ typedef struct parser_t { lexer_t *lexer; } parser_t; -typedef enum { - TYPE_I32 -} type_t; - -typedef struct ast_return_stmt_t { - uint32_t number; -} ast_return_stmt_t; - -typedef struct ast_function_t { - string_view_t name; - type_t return_type; - ast_return_stmt_t body; -} ast_function_t; - void parser_init(parser_t *parser, lexer_t *lexer); ast_function_t parser_parse_function(parser_t *parser); |