Python AST as XML

Dimitre Novatchev dnovatchev at yahoo.com
Thu Nov 4 05:58:39 EST 2004


"Oleg Paraschenko" <olepar at gmail.com> wrote in message 
news:1e015c2a.0410272209.3e831f94 at posting.google.com...
> Hello,
>
> maybe of some interest:
>
> http://pysch.sourceforge.net/ast.html

This is definitely of interest.

An AST as any tree is a perfect fit for XSLT processing. Many people 
overlook the fact that XSLT operates on generic trees, which do not have to 
necessarily originate from an XML document.

My personal experience in implementing graph-processing algorithms in XSLT 
(e.g. Eulerisation of a graph -- the chinese postman and the N.Y street 
sweeper algorithms) shows that XSLT is efficient programming language for 
such problems -- similarly it will be efficient in rewriting and 
optimization.

Do keep the good work, Oleg!


Cheers,

Dimitre.

>
> [quote]
> XML can be considered as an external representation of in-memory
> tree-like structures, and XML-related standards - as methods of
> processing such data. Some types of applications may benefit
> from this approach. One of the examples are compilers with
> theirs parse trees.
>
> The Pysch distribution contains an example of representing Python
> parse trees (abstract syntax trees, AST) as XML and applying an
> XSLT transformation to these trees.
>
> At the moment the whole code should be considered as a toy,
> not as a production version. Anyway, it works.
>
> ...
> [/quote]
>
> --
> Oleg 





More information about the Python-list mailing list