[Python-Dev] AST manipulation and source code generation
Sylvain Thénault
Sylvain.Thenault at logilab.fr
Thu May 26 09:58:10 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?
the astng package from logilab's common library [1] extends compiler AST
nodes with a bunch of methods, including a as_string method on each node
allowing to regenerate a python source code from an ast (other methods
are mainly to ease navigation in the tree or to extract higher level
information from it). Currently it's implemented as a node's method
instead of using a visitor pattern or the like, but that would be easily
done.
[1] http://www.logilab.org/projects/common/
--
Sylvain Thénault LOGILAB, Paris (France).
http://www.logilab.com http://www.logilab.fr http://www.logilab.org
More information about the Python-Dev
mailing list