diff --git a/src/runner/mod.rs b/src/runner/mod.rs index 57ddc345..137eb0da 100644 --- a/src/runner/mod.rs +++ b/src/runner/mod.rs @@ -120,12 +120,19 @@ impl NyashRunner { ".help" => { println!("Commands:"); println!(" .exit / .quit - Exit REPL"); - println!(" .reset - Clear session (Phase 288 P2)"); + println!(" .reset - Clear session"); println!(" .help - Show this help"); continue; } ".reset" => { - println!("Session reset (Phase 288 P2 implementation)"); + // Phase 288 P3: Reset session + let mut session_ref = self.repl_session.borrow_mut(); + if let Some(ref mut session) = *session_ref { + session.reset(); + println!("Session reset"); + } else { + println!("Session reset (no active session)"); + } continue; } "" => continue, @@ -168,8 +175,8 @@ impl NyashRunner { } } - // Parse (minimal wrapper for REPL context) - let code = format!("static box __Repl {{ main() {{ {} }} }}", line); + // Parse (minimal wrapper for REPL context - use Main for VM entry point) + let code = format!("static box Main {{ main() {{ {} }} }}", line); let ast = NyashParser::parse_from_string(&code) .map_err(|e| format!("Parse error: {}", e))?; @@ -185,7 +192,7 @@ impl NyashRunner { let result_box = vm.execute_module(&mir_result.module) .map_err(|e| format!("Runtime error: {}", e))?; - // Phase 288 P2: Convert to VMValue and store in session + // Phase 288 P3: Convert to VMValue and store in session use crate::backend::VMValue; let vm_value = VMValue::from_nyash_box(result_box); @@ -197,7 +204,9 @@ impl NyashRunner { } } - Ok("(execution Phase 288 P3)".to_string()) + // Phase 288 P3: print() output already displayed via ExternCall + // Expression auto-display deferred to Phase 288.1 + Ok(String::new()) } }