Improve diagnostics
This commit is contained in:
parent
83537737f5
commit
0448b56adf
@ -218,16 +218,15 @@ fn compile(file_content: &String, intrinsics: &HashMap<&str, (Vec<Datatype>, Vec
|
|||||||
typecheck(&operations, &functions, &intrinsics, &arrays, debug)?;
|
typecheck(&operations, &functions, &intrinsics, &arrays, debug)?;
|
||||||
println!("---Done typechecking---");
|
println!("---Done typechecking---");
|
||||||
let start = Instant::now();
|
let start = Instant::now();
|
||||||
println!("---Starting to interpret the program---");
|
|
||||||
let output = if interpret
|
let output = if interpret
|
||||||
{
|
{
|
||||||
|
println!("---Starting to interpret the program---");
|
||||||
Some(interpret_program(&operations, &mut Vec::new(), &functions, &mut arrays, &intrinsics, debug)?)
|
Some(interpret_program(&operations, &mut Vec::new(), &functions, &mut arrays, &intrinsics, debug)?)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
None
|
None
|
||||||
};
|
};
|
||||||
println!("---Done after {:?}---", start.elapsed());
|
|
||||||
if !interpret
|
if !interpret
|
||||||
{
|
{
|
||||||
if let Err(err) = generate_assembly_linux_x64(&operations, &functions, &intrinsics, &arrays, debug)
|
if let Err(err) = generate_assembly_linux_x64(&operations, &functions, &intrinsics, &arrays, debug)
|
||||||
@ -237,7 +236,7 @@ fn compile(file_content: &String, intrinsics: &HashMap<&str, (Vec<Datatype>, Vec
|
|||||||
let mut fasm_process = match Command::new("fasm").arg("out.asm").spawn()
|
let mut fasm_process = match Command::new("fasm").arg("out.asm").spawn()
|
||||||
{
|
{
|
||||||
Ok(process) => process,
|
Ok(process) => process,
|
||||||
Err(err) => return Err(err.to_string()),
|
Err(err) => return Err(format!("Fasm process error: {}", err.to_string())),
|
||||||
};
|
};
|
||||||
match fasm_process.wait()
|
match fasm_process.wait()
|
||||||
{
|
{
|
||||||
@ -282,6 +281,7 @@ fn compile(file_content: &String, intrinsics: &HashMap<&str, (Vec<Datatype>, Vec
|
|||||||
Err(err) => Err(err.to_string()),
|
Err(err) => Err(err.to_string()),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
println!("---Done after {:?}---", start.elapsed());
|
||||||
return Ok(output);
|
return Ok(output);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user