[Python-3000] parser/compiler interface [was Re: compiler module]

Georg Brandl g.brandl at gmx.net
Fri Jan 11 16:02:53 CET 2008

Brett Cannon schrieb:
> On Jan 10, 2008 2:08 PM, Joe Angell <joe.d.angell at gmail.com> wrote:
>> Oh I see... forgive my ignorance but could you point me at some
>> documentation or a project that uses the c AST as you mentioned?  Is
>> that done through some part of the C-API?  I cannot find that in the
>> documentation at the moment.
> http://docs.python.org/dev/library/_ast.html

That's also something I wanted to suggest for a cleanup:

Python's code parsing/compiling interface is currently very cluttered:
* you can parse things with parser.suite(), but not create an AST from
   the parse result
* you can create an AST with an undocumented flag to compile(), but not
   compile the resulting AST
* there are too many modules that have to do with parsing and compiling:
   token, symbol, parser, _ast, symtable

I'd suggest a single package to unify all this functionality and an API
that makes it easy to go from every compiling stage to the next, or to
the final code object.


Thus spake the Lord: Thou shalt indent with four spaces. No more, no less.
Four shall be the number of spaces thou shalt indent, and the number of thy
indenting shall be four. Eight shalt thou not indent, nor either indent thou
two, excepting that thou then proceed to four. Tabs are right out.

More information about the Python-3000 mailing list