The top-level of the package defines four functions. If you import
compiler, you will get these functions and a collection of
modules contained in the package.
- parse(buf)
-
Returns an abstract syntax tree for the Python source code in buf.
The function raises SyntaxError if there is an error in the source
code. The return value is a compiler.ast.Module instance that
contains the tree.
- parseFile(path)
-
Return an abstract syntax tree for the Python source code in the file
specified by path. It is equivalent to
parse(open(path).read())
.
- walk(ast, visitor[, verbose])
-
Do a pre-order walk over the abstract syntax tree ast. Call the
appropriate method on the visitor instance for each node
encountered.
- compile(path)
-
Compile the file path and generate the corresponding .pyc
file.
The compiler package contains the following modules:
ast, consts, future,
misc, pyassem, pycodegen, symbols,
transformer, and visitor.
See About this document... for information on suggesting changes.