[Python-Dev] AST manipulation and source code generation
Jeremy Hylton
jhylton at gmail.com
Thu May 26 15:07:30 CEST 2005
On 5/26/05, Chad Whitacre <chad at zetaweb.com> wrote:
> > Would there be any interest in extending the compiler package with tools
> > for AST transformations and for emitting Python source code from ASTs?
>
> Heh, so I guess the answer is "yes."
>
> BTW, how does the concept of AST transformations relate to the concept
> of (Lisp) macros? Am I right to think that they are similar?
I think they are similar, but two key differences are:
- An AST transformation can transform existing syntax but doesn't allow you
to create new syntax.
- An AST transformation has to be explicitly invoked. A macro is
part of the language
proper and has a semantics for how and when macros are evaluated.
Jeremy
More information about the Python-Dev
mailing list