Small fixes

This commit is contained in:
Kyler Olsen 2025-12-02 11:31:46 -07:00
parent a154741176
commit 6f4be5a929
2 changed files with 3 additions and 2 deletions

View File

@ -124,7 +124,7 @@ impl InterpreterState {
}
pub fn stack_top(&self) -> Option<&StackValue> {
self.stack.get(0)
self.stack.get(self.stack.len() - 1)
}
}

View File

@ -67,7 +67,8 @@ pub fn repl() -> i32 {
LexResult::Ok(tokens) => {
for token in tokens {
if !interpreter.execute(token) {
return 1;
println!("A runtime error occured!");
break;
}
}