♻️ Main loop now panics on error

This commit is contained in:
François Autin 2023-03-27 10:21:18 +02:00
parent e77e125f96
commit 8ba63d38a3
No known key found for this signature in database
GPG Key ID: 343F5D382E1DD77C

View File

@ -209,8 +209,12 @@ impl Machine {
///
/// - **machine** which contains a table of instructions
pub fn run(&mut self) {
while let Ok(()) = Machine::one_instruction(self) {}
println!("trace : \n{}", self.registers_trace);
loop {
match Machine::one_instruction(self) {
Ok(()) => (),
Err(e) => panic!("FATAL at pc {} -> {}", self.pc, e)
}
}
}
/// Execute the current instruction