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

Brett Cannon bcannon at gmail.com
Tue Nov 29 01:29:09 CET 2005


On 11/28/05, Greg Ewing <greg.ewing at canterbury.ac.nz> wrote:
> Here's a somewhat radical idea:
>
> Why not write the parser and bytecode compiler in Python?
>
> A .pyc could be bootstrapped from it and frozen into
> the executable.
>

Is there a specific reason you are leaving out the AST, Greg, or do
you count that as part of the bytecode compiler (I think of that as
the AST->bytecode step handled by Python/compile.c)?

While ease of maintenance would be fantastic and would probably lead
to much more language experimentation if more of the core parts of
Python were written in Python, I would worry about performance.  While
generating bytecode is not necessarily an everytime thing, I know
Guido has said he doesn't like punishing the performance of small
scripts in the name of large-scale apps (reason why interpreter
startup time has always been an issue) which tend not to have a .pyc
file.

-Brett


More information about the Python-Dev mailing list