Chapter 17: Compiling Expressions done

This commit is contained in:
Moritz Gmeiner 2023-01-31 22:54:12 +01:00
commit 1cca1494a4
20 changed files with 701 additions and 128 deletions

View file

@ -22,7 +22,7 @@ fn main() {
let cli_args = CliArgs::parse();
if cli_args.vm {
use rlox2_vm::InterpretError;
use rlox2_vm::LoxError;
let mut vm = rlox2_vm::VM::default();
@ -35,9 +35,9 @@ fn main() {
if let Err(err) = rlox2_vm::run(&source, &mut vm) {
eprintln!("{err}");
match err {
InterpretError::LexerError { .. } | InterpretError::CompileError { .. } => std::process::exit(65),
InterpretError::RuntimeError { .. } => std::process::exit(70),
InterpretError::Exit { exit_code } => std::process::exit(exit_code),
LoxError::LexerError { .. } | LoxError::CompileError { .. } => std::process::exit(65),
LoxError::RuntimeError { .. } => std::process::exit(70),
LoxError::Exit { exit_code } => std::process::exit(exit_code),
}
}