/Lib/compiler/__init__.py
Python | 29 lines | 24 code | 0 blank | 5 comment | 1 complexity | 2ff7dd90ff8fb557a1607ed3a6df00eb MD5 | raw file
1"""Package for parsing and compiling Python source code 2 3There are several functions defined at the top level that are imported 4from modules contained in the package. 5 6parse(buf, mode="exec") -> AST 7 Converts a string containing Python source code to an abstract 8 syntax tree (AST). The AST is defined in compiler.ast. 9 10parseFile(path) -> AST 11 The same as parse(open(path)) 12 13walk(ast, visitor, verbose=None) 14 Does a pre-order walk over the ast using the visitor instance. 15 See compiler.visitor for details. 16 17compile(source, filename, mode, flags=None, dont_inherit=None) 18 Returns a code object. A replacement for the builtin compile() function. 19 20compileFile(filename) 21 Generates a .pyc file by compiling filename. 22""" 23from warnings import warnpy3k 24warnpy3k("the compiler package has been removed in Python 3.0", stacklevel=2) 25del warnpy3k 26 27from compiler.transformer import parse, parseFile 28from compiler.visitor import walk 29from compiler.pycodegen import compile, compileFile