Skip to content

Commit

Permalink
Added more in-depth parser documentation and cleaned up the generic p…
Browse files Browse the repository at this point in the history
…arsing structure.
  • Loading branch information
Goubermouche committed Jan 24, 2024
1 parent d29bf6e commit 319cfed
Show file tree
Hide file tree
Showing 5 changed files with 193 additions and 152 deletions.
3 changes: 1 addition & 2 deletions source/compiler/compiler/compiler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,14 @@ namespace sigma {
TRY(const std::string file, utility::fs::file<std::string>::load(m_description.path));
TRY(tokenizer::tokenize(file, &m_description.path, frontend));
TRY(parser::parse(frontend));
frontend.syntax.print_ast();

// backend
// at this point we want to merge all frontend contexts into the backend context
backend_context backend(frontend.syntax, m_description.target);
backend.syntax.print_ast();

// run analysis on the generated AST
TRY(type_checker::type_check(backend));

TRY(ir_translator::translate(backend));

// compile the generated IR module
Expand Down
16 changes: 3 additions & 13 deletions source/compiler/test/main.s
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,8 @@
// - cleanup ir gen alignment sizes (u64 vs u32 vs u16)

i32 main() {
printf("%d\n", sizeof(i8));
printf("%d\n", sizeof(i16));
printf("%d\n", sizeof(i32));
printf("%d\n", sizeof(i64));
printf("%d\n", sizeof(u8));
printf("%d\n", sizeof(u16));
printf("%d\n", sizeof(u32));
printf("%d\n", sizeof(u64));
printf("%d\n", sizeof(bool));
printf("%d\n", sizeof(char));
printf("%d\n", sizeof(i32*));
printf("%d\n", sizeof(i32**));

i32 x = 12u;
printf("%d\n", -x);

ret 0;
}
Loading

0 comments on commit 319cfed

Please sign in to comment.