aboutsummaryrefslogtreecommitdiff
path: root/src/interpreter.rs
diff options
context:
space:
mode:
authorCody <cody@codyq.dev>2023-02-27 12:14:16 -0600
committerCody <cody@codyq.dev>2023-02-27 12:14:16 -0600
commite4199d2837d2179f17e97b8d50366d96c8babded (patch)
treee07543001ba1aa7e05ff8b289b4d3154d7123fd6 /src/interpreter.rs
parentf464fe944808df7865262962b8231c0009874692 (diff)
downloadsloth-e4199d2837d2179f17e97b8d50366d96c8babded.tar.gz
Added while loops & guessing game
Diffstat (limited to 'src/interpreter.rs')
-rw-r--r--src/interpreter.rs5
1 files changed, 5 insertions, 0 deletions
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<Value> 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!(),
};