[Python-Dev] Memory management in the AST parser & compiler

Greg Ewing greg.ewing at canterbury.ac.nz
Tue Nov 29 07:31:49 CET 2005


Brett Cannon wrote:

> Is there a specific reason you are leaving out the AST, Greg, or do
> you count that as part of the bytecode compiler

No, I consider it part of the parser. My mental model
of parsing & compiling in the presence of a parse tree
is like this:

   [source] -> scanner -> [tokens]
     -> parser -> [AST] -> code_generator -> [code]

The fact that there still seems to be another kind of
parse tree in between the scanner and the AST generator
is an oddity which I hope will eventually disappear.

> I know
> Guido has said he doesn't like punishing the performance of small
> scripts in the name of large-scale apps

To me, that's an argument in favour of always generating
a .pyc, even for scripts.

Greg


More information about the Python-Dev mailing list