feat: add typed ast and Hindley-Milner style semantic analysis
This commit is contained in:
+13
-1
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user