mirror of
https://github.com/Noratrieb/dilaria.git
synced 2026-01-14 17:35:03 +01:00
hello world!
This commit is contained in:
parent
92b40b17ed
commit
d1179ff2ea
10 changed files with 263 additions and 112 deletions
|
|
@ -45,18 +45,21 @@ pub fn run_program(program: &str) {
|
|||
}
|
||||
}
|
||||
|
||||
fn process_ast(program: &str, ast: Program, runtime: RtAlloc) {
|
||||
fn process_ast(program: &str, ast: Program, mut runtime: RtAlloc) {
|
||||
println!("AST:\n{:?}\n", ast);
|
||||
|
||||
let bytecode_alloc = Bump::new();
|
||||
|
||||
let bytecode = compile::compile(&ast, &bytecode_alloc);
|
||||
let bytecode = compile::compile(&ast, &bytecode_alloc, &mut runtime);
|
||||
|
||||
match bytecode {
|
||||
Ok(code) => {
|
||||
println!("Bytecode:\n{:#?}\n", code);
|
||||
|
||||
let _result_lol = vm::execute(&code, runtime);
|
||||
let result = vm::execute(&code, runtime);
|
||||
if let Err(result) = result {
|
||||
eprintln!("error: {}", result);
|
||||
}
|
||||
}
|
||||
Err(err) => errors::display_error(program, err),
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue