From ee1a5de91c875fb66724dc21c02333bfebe2a812 Mon Sep 17 00:00:00 2001 From: Bad Diode Date: Tue, 1 Feb 2022 18:36:52 +0100 Subject: Add new syntax to lexer and prepare refactor --- src/main.c | 56 +++++++++++++++++++++++++++----------------------------- 1 file changed, 27 insertions(+), 29 deletions(-) (limited to 'src/main.c') diff --git a/src/main.c b/src/main.c index 30eab2b..17dd481 100644 --- a/src/main.c +++ b/src/main.c @@ -7,8 +7,8 @@ #include "string_view.c" #include "errors.c" #include "lexer.c" -#include "parser.c" -#include "ir.h" +// #include "parser.c" +// #include "ir.h" // #include "compiler.h" void @@ -23,34 +23,32 @@ halt(void) { void process_source(const StringView *source, const char *file_name) { - Errors errors = {0}; - // Read tokens. - Token *tokens = tokenize(source, &errors); - if (errors.n != 0) { - report_errors(&errors, file_name); - array_free(tokens); - exit(EXIT_FAILURE); - } - - // Parser. - Program program = parse(tokens, &errors); - if (errors.n != 0) { - report_errors(&errors, file_name); - free_objects(); - array_free(tokens); - exit(EXIT_FAILURE); - } - array_free(tokens); - - // TODO: Optimization. - - // Compilation. - ProgramIr program_ir = compile(program); - (void)program_ir; - - // Free resources. - free_objects(); + Token *tokens = tokenize(source); + print_tokens(tokens); + check_errors(file_name); + // if (errors.n != 0) { + // exit(EXIT_FAILURE); + // } + + // // Parser. + // Program program = parse(tokens, &errors); + // if (errors.n != 0) { + // report_errors(&errors, file_name); + // free_objects(); + // array_free(tokens); + // exit(EXIT_FAILURE); + // } + // array_free(tokens); + + // // TODO: Optimization. + + // // Compilation. + // ProgramIr program_ir = compile(program); + // (void)program_ir; + + // // Free resources. + // free_objects(); } void -- cgit v1.2.1