feat: add typed ast and Hindley-Milner style semantic analysis

This commit is contained in:
2026-04-20 22:33:41 +02:00
parent 27d033135c
commit c3ee0d6e67
5 changed files with 699 additions and 3 deletions
+13 -1
View File
@@ -1,6 +1,7 @@
use std::{env::args, fs::read_to_string, process::exit};
use crate::frontend::parser::Parser;
use crate::frontend::sema::Sema;
pub mod frontend;
@@ -26,5 +27,16 @@ fn main() {
exit(1);
}
println!("{:#?}", module);
let mut sema = Sema::new();
let typed_module = sema.analyze_module(&module);
if let Some(errors) = sema.errors() {
for error in errors {
eprintln!("{:?}", error);
}
exit(1);
}
println!("{:#?}", typed_module);
}