implement type checking and constand folding for simple example

This commit is contained in:
2021-10-24 22:48:04 +02:00
parent e6a6fd1535
commit d4a5d62255
5 changed files with 377 additions and 46 deletions

View File

@@ -1,11 +1,17 @@
mod parser;
mod ast;
mod typecheck;
mod constfold;
fn main() {
let input = include_str!("../test.hw");
let result = parser::parse(input);
match result {
Ok(script) => {dbg!(script);},
Ok(mut script) => {
constfold::fold_script(&mut script);
typecheck::tc_script(&mut script).unwrap();
dbg!(script);
},
Err(err) => println!("error: {}", nom::error::convert_error(input, err))
}
}