diff --git a/src/executor.py b/src/executor.py index 3d2dce0..32ed2bd 100644 --- a/src/executor.py +++ b/src/executor.py @@ -112,7 +112,7 @@ def instruction_negate(self, args, bindings): def instruction_not(self, args, bindings): ((_, target),) = args old = bindings.resolve(target) - bindings.assign(target, 0 if old else old) + bindings.assign(target, 0 if old else 1) def instruction_if(self, args, bindings): for index in range(0, len(args) - 1, 2): diff --git a/tests/not.imp b/tests/not.imp index 882edaa..c37798e 100644 --- a/tests/not.imp +++ b/tests/not.imp @@ -6,4 +6,14 @@ main begin if x do exit 1 end + + push 0 + pop x + not x + + if x do + exit 0 + end + + exit 1 end \ No newline at end of file