[pypy-svn] r26963 - in pypy/dist/pypy/translator: . goal

ericvrp at codespeak.net ericvrp at codespeak.net
Mon May 8 14:36:11 CEST 2006


Author: ericvrp
Date: Mon May  8 14:36:10 2006
New Revision: 26963

Modified:
   pypy/dist/pypy/translator/driver.py
   pypy/dist/pypy/translator/goal/translate.py
Log:
Enable Javscript translations of standalone targets.


Modified: pypy/dist/pypy/translator/driver.py
==============================================================================
--- pypy/dist/pypy/translator/driver.py	(original)
+++ pypy/dist/pypy/translator/driver.py	Mon May  8 14:36:10 2006
@@ -404,6 +404,26 @@
     task_run_squeak = taskdef(task_run_squeak, ['compile_squeak'],
                               'XXX')
 
+    def task_source_js(self):
+        from pypy.translator.js.js import JS
+        self.gen = JS(self.translator, functions=[self.entry_point],
+                      stackless=self.options.stackless)
+        filename = self.gen.write_source()
+        self.log.info("Wrote %s" % (filename,))
+    task_source_js = taskdef(task_source_js, 
+                        ['stackcheckinsertion', 'backendopt', 'rtype'],
+                        'Generating Javascript source')
+
+    def task_compile_js(self):
+        pass
+    task_compile_js = taskdef(task_compile_js, ['source_js'],
+                              'Skipping Javascript compilation')
+
+    def task_run_js(self):
+        pass
+    task_run_js = taskdef(task_run_js, ['compile_js'],
+                              'Please manually run the generated code')
+
     def proceed(self, goals):
         if not goals:
             if self.default_goal:

Modified: pypy/dist/pypy/translator/goal/translate.py
==============================================================================
--- pypy/dist/pypy/translator/goal/translate.py	(original)
+++ pypy/dist/pypy/translator/goal/translate.py	Mon May  8 14:36:10 2006
@@ -46,7 +46,7 @@
     '0_source': [OPT(('-s', '--source'), "Generate source code", GOAL),
                OPT(('--no-source',), "Don't generate source code", SKIP_GOAL)],
 
-    '1_backend': [OPT(('-b', '--backend'), "Backend", ['c', 'llvm', 'cl', 'squeak'])],
+    '1_backend': [OPT(('-b', '--backend'), "Backend", ['c', 'llvm', 'cl', 'squeak', 'js'])],
 
     '2_gc': [OPT(('--gc',), "Garbage collector", ['boehm', 'ref', 'framework', 'none', 'exact_boehm'])],
     '3_stackless': [OPT(('--stackless',), "Stackless code generation", True)],



More information about the Pypy-commit mailing list