mirror of
https://github.com/odin-lang/Odin.git
synced 2026-06-15 14:53:43 +00:00
Initial Commit
Original Git Repo "went bad" so I had to restart.
This commit is contained in:
41
src/main.cpp
Normal file
41
src/main.cpp
Normal file
@@ -0,0 +1,41 @@
|
||||
#include "common.cpp"
|
||||
#include "tokenizer.cpp"
|
||||
#include "parser.cpp"
|
||||
#include "printer.cpp"
|
||||
#include "checker.cpp"
|
||||
#include "generator.cpp"
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
if (argc < 2) {
|
||||
gb_printf_err("Please specify a .odin file\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
init_global_scope();
|
||||
|
||||
for (int arg_index = 1; arg_index < argc; arg_index++) {
|
||||
char *arg = argv[arg_index];
|
||||
char *filename = arg;
|
||||
Parser parser = {0};
|
||||
|
||||
if (init_parser(&parser, filename)) {
|
||||
defer (destroy_parser(&parser));
|
||||
AstNode *root_node = parse_statement_list(&parser, NULL);
|
||||
// print_ast(root_node, 0);
|
||||
|
||||
Checker checker = {};
|
||||
init_checker(&checker, &parser);
|
||||
defer (destroy_checker(&checker));
|
||||
|
||||
check_statement_list(&checker, root_node);
|
||||
|
||||
Generator generator = {};
|
||||
if (init_generator(&generator, &checker)) {
|
||||
defer (destroy_generator(&generator));
|
||||
generate_code(&generator, root_node);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user