Debian Codegraph @

rpython/translator/goal/targetrecursivestandalone.py

raw symbols SCIP
1 """
2 A simple deeply recursive target.
3
4 The target below specifies None as the argument types list.
5 This is a case treated specially in driver.py . If the list
6 of input types is empty, it is meant to be a list of strings,
7 actually implementing argv of the executable.
8 """
9
10 import os, sys
11
12 def debug(msg):
13 os.write(2, "debug: " + msg + '\n')
14
15 # __________ Entry point __________
16
17 def ackermann(x, y):
18 if x == 0:
19 return y + 1
20 if y == 0:
21 return ackermann(x - 1, 1)
22 return ackermann(x - 1, ackermann(x, y - 1))
23
24 def entry_point(argv):
25 debug(str(ackermann(3, 12)) + "\n")
26 return 0
27
28 # _____ Define and setup target ___
29
30 def target(*args):
31 return entry_point, None