[pypy-svn] r16280 - in pypy/dist/pypy: interpreter/pyparser translator/goal

ludal at codespeak.net ludal at codespeak.net
Tue Aug 23 16:55:01 CEST 2005


Author: ludal
Date: Tue Aug 23 16:55:00 2005
New Revision: 16280

Added:
   pypy/dist/pypy/translator/goal/targetcompiler.py
Modified:
   pypy/dist/pypy/interpreter/pyparser/pythonutil.py
Log:
 a new target to try and translate the whole compiler


Modified: pypy/dist/pypy/interpreter/pyparser/pythonutil.py
==============================================================================
--- pypy/dist/pypy/interpreter/pyparser/pythonutil.py	(original)
+++ pypy/dist/pypy/interpreter/pyparser/pythonutil.py	Tue Aug 23 16:55:00 2005
@@ -107,6 +107,14 @@
     PYTHON_PARSER.parse_source(input, target, builder)
     return builder.rule_stack[-1]
 
+def ast_compile(input, mode):
+    from pypy.interpreter.astcompiler import ast, misc, pycodegen
+    ast_tree = ast_from_input_( input, mode )
+    misc.set_filename("<?>", ast_tree)
+    codegenerator = pycodegen.InteractiveCodeGenerator(ast_tree)
+    code1 = codegenerator.getCode()
+    return code1
+
 
 def internal_pypy_parse_to_ast(source, mode='exec', lineno=False, flags=0):
     builder = AstBuilder()

Added: pypy/dist/pypy/translator/goal/targetcompiler.py
==============================================================================
--- (empty file)
+++ pypy/dist/pypy/translator/goal/targetcompiler.py	Tue Aug 23 16:55:00 2005
@@ -0,0 +1,24 @@
+import os, sys
+from pypy.annotation.model import *
+from pypy.annotation.listdef import ListDef
+
+# WARNING: this requires the annotator.
+# There is no easy way to build all caches manually,
+# but the annotator can do it for us for free.
+
+this_dir = os.path.dirname(sys.argv[0])
+
+# from pypy.interpreter.pyparser.pythonutil import annotateme
+# __________  Entry point  __________
+# entry_point = annotateme
+
+from pypy.interpreter.pyparser.pythonutil import ast_compile
+entry_point = ast_compile
+
+# _____ Define and setup target ___
+def target():
+    return entry_point, [str, str]
+
+# _____ Run translated _____
+def run(c_entry_point):
+    pass



More information about the Pypy-commit mailing list