Ast tree and python code

Ira Baxter idbaxter at semdesigns.com
Sat Mar 6 10:04:38 EST 2004


"Yermat" <loic at yermat.net1.nerim.net> wrote in message
news:c25e3r$2052$1 at biggoron.nerim.net...
> Does someone know how I can reverse an AST tree back into python code
> with few modification ?
> What I want to do is to complete trees before writing them back but in a
> way not to far from the original code ? Especially, indentation, line
> return, etc.
>
> Of course, I could program it myself but if someone already done it...

If you insist on doing this in Python, I don't have any help.

Otherwise, if you want to carry out arbitrary transforms on Python code,
you might be interested in the DMS Software Reengineering Toolkit.
It parses many languages (including Python) into a language
specific AST, can carry out source-to-source transformations
on those trees, and can then prettyprint source text from
those tree.   It retains comments, indentation, the
format of numbers, you name it.

See http://www.semanticdesigns.com/Products/DMS/DMSToolkit.html.


-- 
Ira D. Baxter, Ph.D., CTO   512-250-1018
Semantic Designs, Inc.      www.semdesigns.com




----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeed.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
---= 19 East/West-Coast Specialized Servers - Total Privacy via Encryption =---



More information about the Python-list mailing list