[pypy-svn] r22739 - pypy/extradoc/talk/mallorca-talk-2006

cfbolz at codespeak.net cfbolz at codespeak.net
Fri Jan 27 15:00:02 CET 2006


Author: cfbolz
Date: Fri Jan 27 14:59:58 2006
New Revision: 22739

Added:
   pypy/extradoc/talk/mallorca-talk-2006/   (props changed)
   pypy/extradoc/talk/mallorca-talk-2006/interpreter-overview.png
      - copied unchanged from r22720, pypy/eu-tracking/talk/review1/image/interpreter-overview.png
   pypy/extradoc/talk/mallorca-talk-2006/run_example1.py   (contents, props changed)
   pypy/extradoc/talk/mallorca-talk-2006/talk.txt
      - copied, changed from r22720, pypy/extradoc/talk/22c3/hpk-tech.txt
   pypy/extradoc/talk/mallorca-talk-2006/translation-overview.png
      - copied unchanged from r22720, pypy/extradoc/talk/22c3/translation-overview.png
   pypy/extradoc/talk/mallorca-talk-2006/wp5_example.py   (contents, props changed)
Log:
add the slides for the mallorca talk


Added: pypy/extradoc/talk/mallorca-talk-2006/run_example1.py
==============================================================================
--- (empty file)
+++ pypy/extradoc/talk/mallorca-talk-2006/run_example1.py	Fri Jan 27 14:59:58 2006
@@ -0,0 +1,21 @@
+from pypy.translator.interactive import Translation
+from pypy.annotation.model import SomeInteger
+
+try:
+    import rlcompleter2
+    rlcompleter2.setup()
+except ImportError:
+    pass
+
+import wp5_example
+
+t = Translation(wp5_example.is_prime)
+t.annotate([SomeInteger(nonneg=True)])
+t.view()
+t.rtype()
+t.view()
+t.backendopt(backend="c")
+t.view()
+f = t.compile()
+print "value returned by the compiled function with argument 5"
+print f(5)

Added: pypy/extradoc/talk/mallorca-talk-2006/wp5_example.py
==============================================================================
--- (empty file)
+++ pypy/extradoc/talk/mallorca-talk-2006/wp5_example.py	Fri Jan 27 14:59:58 2006
@@ -0,0 +1,51 @@
+def find_divisors(n):
+    divisors = []
+    for i in range(1, n + 1):
+        if n % i == 0:
+            divisors.append(i)
+    return divisors
+
+def is_prime(n):
+    divisors = find_divisors(n)
+    return len(divisors) == 2
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+class Expr(object):
+    pass
+
+class Value(Expr):
+    def __init__(self, value):
+        self.value = value
+
+    def eval(self):
+        return self.value
+
+class Plus(Expr):
+    def __init__(self, expr1, expr2):
+        self.expr1 = expr1
+        self.expr2 = expr2
+
+    def eval(self):
+        return self.expr1.eval() + self.expr2.eval()
+
+expr = Plus(Value(5), Plus(Value(30), Value(7)))
+
+def example():
+    return expr.eval()



More information about the Pypy-commit mailing list