aboutsummaryrefslogtreecommitdiff
path: root/interpreter.py
diff options
context:
space:
mode:
authormryouse2022-05-20 21:15:12 +0000
committermryouse2022-05-20 21:15:12 +0000
commitf9f4a11e9bde67bf3ab52fa7f3cef04fde98a579 (patch)
tree6766bab6e27c4d9dbeff7fe29a1b5d8349de08c2 /interpreter.py
parentaec71d9d309bca41d587a21e8fb11cd7f167d815 (diff)
bugfix: make recursion work (though introduce a new issue too)
Diffstat (limited to 'interpreter.py')
-rw-r--r--interpreter.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/interpreter.py b/interpreter.py
index d5b2b4c..6ad7d84 100644
--- a/interpreter.py
+++ b/interpreter.py
@@ -37,7 +37,8 @@ class UserFunction(Function):
def call(self, expr, env):
this_env = Environment(env)
for idx, param in enumerate(self.params):
- this_env.register(param.name, expr.args[idx])
+ # TODO this is wrong!!! this won't always be a literal
+ this_env.register(param.name, Expr.Literal(evaluate(expr.args[idx],env)))
return interpret(self.body, this_env)
class Environment: