This commit is contained in:
minish 2025-12-04 20:55:58 -05:00
parent 4fa6cd9ae0
commit bfafb46f38
Signed by: min
SSH Key Fingerprint: SHA256:mf+pUTmK92Y57BuCjlkBdd82LqztTfDCQIUp0fCKABc
3 changed files with 806 additions and 804 deletions

View File

@ -473,6 +473,7 @@ impl<'a> FuncBuild<'a> {
Val::Nil
}
}
Expr::If(cond, true_case, false_case) => todo!(),
/* captured literal */
Expr::Literal(lit) if do_yield => {
@ -629,8 +630,6 @@ impl<'a> FuncBuild<'a> {
Expr::LessThanOrEqualTo(l, r) => {
self.translate(Expr::GreaterThanOrEqualTo(r, l), do_compute, false)
}
e => unimplemented!("{e:?}"),
}
}
}

View File

@ -9,21 +9,25 @@ mod parser;
mod vm;
fn main() {
// lexer (iterator)
let script = std::fs::read_to_string("./start.lf").unwrap();
let lexer = Lexer::new(script.chars());
let mut parser = Parser::new(lexer.map(Result::unwrap));
// parser
let start = Instant::now();
let block = parser.parse().unwrap();
println!("Parse took {:?}", start.elapsed());
let mut e = parser::Expr::Block(block);
parser::util::display(&e);
// compiler - analysis
let start = Instant::now();
compiler::analysis_demo(&mut e);
println!("Analysis took {:?}", start.elapsed());
parser::util::display(&e);
// compiler - translation
let start = Instant::now();
let insts = compiler::translation_demo(e);
println!("Translation took {:?}", start.elapsed());
@ -31,6 +35,7 @@ fn main() {
println!("=> {i:?}");
}
// vm
println!("Starting VM!!!!!!!!!!!!!!!!");
let start = Instant::now();
let out = vm::run(&insts);

View File

@ -46,8 +46,6 @@ impl<'a> FuncVm<'a> {
while pc < insts.len() {
let inst = &insts[pc];
// println!("{}> {:?} {inst:?}", "=".repeat(self.depth), self.locals);
match inst {
/* rhs */
Not(a) | Return(a) => {