From 6f4be5a929904c5d4c275c23fbd286d152471b16 Mon Sep 17 00:00:00 2001 From: Kyler Date: Tue, 2 Dec 2025 11:31:46 -0700 Subject: [PATCH] Small fixes --- SLS_Rust/sls/src/interpreter.rs | 2 +- SLS_Rust/sls/src/repl.rs | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/SLS_Rust/sls/src/interpreter.rs b/SLS_Rust/sls/src/interpreter.rs index 4842980..bdafc86 100644 --- a/SLS_Rust/sls/src/interpreter.rs +++ b/SLS_Rust/sls/src/interpreter.rs @@ -124,7 +124,7 @@ impl InterpreterState { } pub fn stack_top(&self) -> Option<&StackValue> { - self.stack.get(0) + self.stack.get(self.stack.len() - 1) } } diff --git a/SLS_Rust/sls/src/repl.rs b/SLS_Rust/sls/src/repl.rs index 1bfa9be..dd0718a 100644 --- a/SLS_Rust/sls/src/repl.rs +++ b/SLS_Rust/sls/src/repl.rs @@ -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; } }