Jeremy Hylton | 8c78341 | 2000-03-06 19:04:14 +0000 | [diff] [blame] | 1 | """Package for parsing and compiling Python source code |
| 2 | |
| 3 | There are several functions defined at the top level that are imported |
| 4 | from modules contained in the package. |
| 5 | |
| 6 | parse(buf) -> AST |
| 7 | Donverts a string containing Python source code to an abstract |
| 8 | syntax tree (AST). The AST is defined in compiler.ast. |
| 9 | |
| 10 | parseFile(path) -> AST |
| 11 | The same as parse(open(path)) |
| 12 | |
| 13 | walk(ast, visitor, verbose=None) |
| 14 | Does a pre-order walk over the ast using the visitor instance. |
| 15 | See compiler.visitor for details. |
Jeremy Hylton | f728f9a1 | 2000-03-06 19:12:33 +0000 | [diff] [blame] | 16 | |
| 17 | compile(filename) |
| 18 | Generates a .pyc file by compilining filename. |
Jeremy Hylton | 8c78341 | 2000-03-06 19:04:14 +0000 | [diff] [blame] | 19 | """ |
| 20 | |
| 21 | from transformer import parse, parseFile |
| 22 | from visitor import walk |
Jeremy Hylton | f728f9a1 | 2000-03-06 19:12:33 +0000 | [diff] [blame] | 23 | from pycodegen import compile |
Jeremy Hylton | 8c78341 | 2000-03-06 19:04:14 +0000 | [diff] [blame] | 24 | |