From db5564306399f0a3af97eb13808140542aa5b42c Mon Sep 17 00:00:00 2001 From: mryouse Date: Tue, 10 May 2022 04:12:04 +0000 Subject: nested expressions! --- runner.py | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'runner.py') diff --git a/runner.py b/runner.py index 8e4f86d..0d8560e 100644 --- a/runner.py +++ b/runner.py @@ -23,6 +23,12 @@ def evaluate(items, pop): if not nxt.symbol.name in STD: raise Exception(f"no such symbol: {nxt.symbol.name}") this_func = STD[nxt.symbol.name] + + # evaluate inner expressions + for idx, arg in enumerate(nxt.args): + if isinstance(arg, NebExpression): + nxt.args[idx] = evaluate([arg], pop) + if nxt.maybe_sig() not in this_func: raise Exception(f"'{nxt.symbol.name}' called with unknown signature: '{nxt.maybe_sig()}'") ret = this_func[nxt.maybe_sig()].impl(*(nxt.args)) -- cgit v1.2.3