Created
July 16, 2011 15:24
-
-
Save Neppord/1086444 to your computer and use it in GitHub Desktop.
pypy translate error
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[translation:ERROR] Error: | |
[translation:ERROR] Traceback (most recent call last): | |
[translation:ERROR] File "../pypy/pypy/translator/goal/translate.py", line 308, in main | |
[translation:ERROR] drv.proceed(goals) | |
[translation:ERROR] File "/Users/neppord/pypy/pypy/translator/driver.py", line 810, in proceed | |
[translation:ERROR] return self._execute(goals, task_skip = self._maybe_skip()) | |
[translation:ERROR] File "/Users/neppord/pypy/pypy/translator/tool/taskengine.py", line 116, in _execute | |
[translation:ERROR] res = self._do(goal, taskcallable, *args, **kwds) | |
[translation:ERROR] File "/Users/neppord/pypy/pypy/translator/driver.py", line 286, in _do | |
[translation:ERROR] res = func() | |
[translation:ERROR] File "/Users/neppord/pypy/pypy/translator/driver.py", line 371, in task_rtype_lltype | |
[translation:ERROR] crash_on_first_typeerror=insist) | |
[translation:ERROR] File "/Users/neppord/pypy/pypy/rpython/rtyper.py", line 211, in specialize | |
[translation:ERROR] self.specialize_more_blocks() | |
[translation:ERROR] File "/Users/neppord/pypy/pypy/rpython/rtyper.py", line 254, in specialize_more_blocks | |
[translation:ERROR] self.specialize_block(block) | |
[translation:ERROR] File "/Users/neppord/pypy/pypy/rpython/rtyper.py", line 408, in specialize_block | |
[translation:ERROR] self.gottypererror(e, block, hop.spaceop, newops) | |
[translation:ERROR] File "/Users/neppord/pypy/pypy/rpython/rtyper.py", line 406, in specialize_block | |
[translation:ERROR] self.translate_hl_to_ll(hop, varmapping) | |
[translation:ERROR] File "/Users/neppord/pypy/pypy/rpython/rtyper.py", line 535, in translate_hl_to_ll | |
[translation:ERROR] resultvar = hop.dispatch() | |
[translation:ERROR] File "/Users/neppord/pypy/pypy/rpython/rtyper.py", line 768, in dispatch | |
[translation:ERROR] return translate_meth(self) | |
[translation:ERROR] File "<336-codegen /Users/neppord/pypy/pypy/rpython/rtyper.py:620>", line 5, in translate_op_ne | |
[translation:ERROR] return pair(r_arg1, r_arg2).rtype_ne(hop) | |
[translation:ERROR] File "/Users/neppord/pypy/pypy/rpython/rmodel.py", line 311, in missing_rtype_operation | |
[translation:ERROR] "'%s' on %r" % (opname, self)) | |
[translation:ERROR] MissingRTypeOperation: unimplemented operation: 'ne' on (<InstanceRepr for main.AckermanNode>, <NoneFrozenPBCRepr Void>) | |
[translation:ERROR] .. (main:28)ackerman_iter | |
[translation:ERROR] .. block@27 with 2 exits(v0) | |
[translation:ERROR] .. v2 = ne(v1, (None)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class AckermanNode(object): | |
def __init__(self, n, next=None): | |
self.n = n | |
self.next = next | |
def step(self): | |
m = self.next.n | |
n = self.n | |
node = self.next.next | |
if m == 0: | |
return AckermanNode(n + 1, node) | |
elif m > 0 and n == 0: | |
return AckermanNode(1, AckermanNode(m - 1, node)) | |
else: | |
m_1 = m - 1 | |
for i in range(n): | |
node = AckermanNode(m_1, node) | |
return AckermanNode(0, AckermanNode(m, node)) | |
def ackerman(m, n): | |
if m == 0: | |
return n + 1 | |
elif m > 0 and n == 0: | |
return ackerman(m - 1, 1) | |
else: | |
return ackerman(m - 1, ackerman(m, n - 1)) | |
def ackerman_iter(m, n): | |
node = AckermanNode(n, AckermanNode(m)) | |
while node.next != None: | |
node = node.step() | |
return node.n | |
def ackerman_tuple(m, n, t): | |
if m == 0: | |
return (n + 1, t) | |
elif m > 0 and n == 0: | |
return (1, (m - 1, t)) | |
else: | |
m_1 = m - 1 | |
for i in range(n): | |
t = (m_1, t) | |
return (0, (m, t)) | |
def entry_point(argv): | |
print ackerman_iter(int(argv[1]), int(argv[2])) | |
return 0 | |
def target(*args): | |
return entry_point, None | |
if __name__ == "__main__": | |
import sys | |
entry_point(sys.argv) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment