From e4199d2837d2179f17e97b8d50366d96c8babded Mon Sep 17 00:00:00 2001 From: Cody Date: Mon, 27 Feb 2023 12:14:16 -0600 Subject: Added while loops & guessing game --- src/interpreter.rs | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/interpreter.rs') diff --git a/src/interpreter.rs b/src/interpreter.rs index b548d9e..adf6755 100644 --- a/src/interpreter.rs +++ b/src/interpreter.rs @@ -69,6 +69,11 @@ impl AstVisitor for AstInterpreter { self.memory.remove(binding); } + Stmt::While { condition, body } => { + while self.visit_expr(condition) == Value::Bool(true) { + self.interpret(body); + } + } Stmt::Return { value } => todo!(), }; -- cgit v1.2.3