[Python-Dev] AST manipulation and source code generation

Jeremy Hylton jhylton at gmail.com
Tue May 24 15:56:15 CEST 2005


On 5/24/05, Ka-Ping Yee <python-dev at zesty.ca> wrote:
> Would there be any interest in extending the compiler package with tools
> for AST transformations and for emitting Python source code from ASTs?

Sure.  Eventually, we'll have to figure out how to unify the compiler
package AST and the ast-branch AST, but don't let that delay you now.

> I was experimenting with possible translations for exception chaining
> and wanted to run some automated tests, so i started playing around
> with the compiler package to do source-to-source transformations.
> Then i started working on a way to do template-based substitution of
> ASTs and a way to spit source code back out, and i'm wondering if
> that might be good for experimenting with future Python features.
> 
> (If there's already stuff out there for doing this, let me know --
> i don't intend to duplicate existing work.)

I don't know of any existing work, but it certainly sounds useful.

Jeremy


More information about the Python-Dev mailing list