[pypy-svn] r58673 - pypy/branch/2.5-merge/pypy/interpreter/astcompiler
arigo at codespeak.net
arigo at codespeak.net
Mon Oct 6 17:54:46 CEST 2008
Author: arigo
Date: Mon Oct 6 17:54:46 2008
New Revision: 58673
Modified:
pypy/branch/2.5-merge/pypy/interpreter/astcompiler/__init__.py
pypy/branch/2.5-merge/pypy/interpreter/astcompiler/pycodegen.py
Log:
(iko, arigo)
Kill kill kill unused code.
Modified: pypy/branch/2.5-merge/pypy/interpreter/astcompiler/__init__.py
==============================================================================
--- pypy/branch/2.5-merge/pypy/interpreter/astcompiler/__init__.py (original)
+++ pypy/branch/2.5-merge/pypy/interpreter/astcompiler/__init__.py Mon Oct 6 17:54:46 2008
@@ -1,26 +1 @@
-"""Package for parsing and compiling Python source code
-
-There are several functions defined at the top level that are imported
-from modules contained in the package.
-
-parse(buf, mode="exec") -> AST
- Converts a string containing Python source code to an abstract
- syntax tree (AST). The AST is defined in compiler.ast.
-
-parseFile(path) -> AST
- The same as parse(open(path))
-
-walk(ast, visitor, verbose=None)
- Does a pre-order walk over the ast using the visitor instance.
- See compiler.visitor for details.
-
-compile(source, filename, mode, flags=None, dont_inherit=None)
- Returns a code object. A replacement for the builtin compile() function.
-
-compileFile(filename)
- Generates a .pyc file by compiling filename.
-"""
-
-# from transformer import parse, parseFile
-# from visitor import walk
-# from pycodegen import compile, compileFile
+# empty
Modified: pypy/branch/2.5-merge/pypy/interpreter/astcompiler/pycodegen.py
==============================================================================
--- pypy/branch/2.5-merge/pypy/interpreter/astcompiler/pycodegen.py (original)
+++ pypy/branch/2.5-merge/pypy/interpreter/astcompiler/pycodegen.py Mon Oct 6 17:54:46 2008
@@ -34,20 +34,6 @@
from pypy.module.__builtin__.__init__ import BUILTIN_TO_INDEX
-def compileFile(filename, display=0):
- f = open(filename, 'U')
- buf = f.read()
- f.close()
- mod = Module(buf, filename)
- try:
- mod.compile(display)
- except SyntaxError:
- raise
- else:
- f = open(filename + "c", "wb")
- mod.dump(f)
- f.close()
-
def compile(source, filename, mode, flags=None, dont_inherit=None):
"""Replacement for builtin compile() function"""
if flags is not None or dont_inherit is not None:
@@ -110,21 +96,6 @@
print pprint.pprint(tree)
self.code = gen.getCode()
- def dump(self, f):
- f.write(self.getPycHeader())
- marshal.dump(self.code, f)
-
- MAGIC = imp.get_magic()
-
- def getPycHeader(self):
- # compile.c uses marshal to write a long directly, with
- # calling the interface that would also generate a 1-byte code
- # to indicate the type of the value. simplest way to get the
- # same effect is to call marshal and then skip the code.
- mtime = os.path.getmtime(self.filename)
- mtime = struct.pack('<i', mtime)
- return self.MAGIC + mtime
-
class CodeGenerator(ast.ASTVisitor):
"""Defines basic code generator for Python bytecode
"""
@@ -1592,7 +1563,3 @@
def visitSubscript(self, node):
self.main.emit('ROT_THREE')
self.main.emit('STORE_SUBSCR')
-
-if __name__ == "__main__":
- for file in sys.argv[1:]:
- compileFile(file)
More information about the Pypy-commit
mailing list