diff options
Diffstat (limited to 'boot/catboot.c')
| -rw-r--r-- | boot/catboot.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/boot/catboot.c b/boot/catboot.c index fec47c0..23b649e 100644 --- a/boot/catboot.c +++ b/boot/catboot.c @@ -23,6 +23,7 @@ #include "common.c" #include "lex.c" #include "tree.c" +#include "parse.c" const ascii* read_file(const ascii* path) @@ -57,10 +58,27 @@ main(const int32 argc, const ascii* argv[]) lexer_new(&lexer, source); struct Token token; + printf("tokens: "); do { token = lexer_next(&lexer); printf("%s ", token_kind_to_string(token.kind)); } while (token.kind != TOKEN_END_OF_FILE); + printf("\n"); + + // reset lexer + lexer_new(&lexer, source); + + struct Parser parser; + parser_new(&parser, &lexer); + + struct Parser_Error parser_error = parser_error_none(); + struct Tree tree = parser_do_your_thing(&parser, &parser_error); + if (!parser_error_is_none(&parser_error)) { + printf("parser error: %s\n", parser_error_to_string(&parser_error)); + return EXIT_FAILURE; + } + + tree_print(&tree); return EXIT_SUCCESS; } |
