diff options
| author | Cody <cody@codyq.dev> | 2023-02-27 12:14:16 -0600 |
|---|---|---|
| committer | Cody <cody@codyq.dev> | 2023-02-27 12:14:16 -0600 |
| commit | e4199d2837d2179f17e97b8d50366d96c8babded (patch) | |
| tree | e07543001ba1aa7e05ff8b289b4d3154d7123fd6 /src/interpreter.rs | |
| parent | f464fe944808df7865262962b8231c0009874692 (diff) | |
| download | sloth-e4199d2837d2179f17e97b8d50366d96c8babded.tar.gz | |
Added while loops & guessing game
Diffstat (limited to 'src/interpreter.rs')
| -rw-r--r-- | src/interpreter.rs | 5 |
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!(), }; |
