This brings Python Joy into congruence with Nim.

It's hacky.  I edited the generated file.  The more complicated
functions like popop will not generate the same errors as the Nim
versions.  This is only congruence in the sense that the current jtest
suite passes identically on both.

Ideally I should be generating both the Nim and Python code from the
Prolog compiler.
This commit is contained in:
Simon Forman
2021-04-09 18:01:07 -07:00
parent 8e0472a5ff
commit 7f193fbdbe
3 changed files with 9 additions and 9 deletions
+3 -3
View File
@@ -67,10 +67,10 @@ def cons(stack):
"""
try: s0, stack = stack
except ValueError: raise StackUnderflowError
if not isinstance(s0, tuple): raise NotAListError
except ValueError: raise StackUnderflowError('Not enough values on stack.')
if not isinstance(s0, tuple): raise NotAListError('Not a list.')
try: a1, s23 = stack
except ValueError: raise StackUnderflowError
except ValueError: raise StackUnderflowError('Not enough values on stack.')
return ((a1, s0), s23)