On Tue, Sep 27, 2011 at 1:29 PM, Michael Foord <[email protected]> wrote: .. > > If the AST contains (stores) the original tokens the collapsing an AST back > to "code" should be trivial. At resolver systems we used PLY to rewrite a > custom language to Python via AST transformations. Each AST node had a > "collapse" method (recursive) that would return a string representing the > node. > > Having parsed you could get code back by calling collapse on the top level > node.
That sounds like the best idea. I'll try this. Do you happen to have a public example ? Cheers > > Michael Foord > > > > > >> >> Thanks >> Tarek >> >> -- >> Tarek Ziadé | http://ziade.org >> >> -- >> You received this message because you are subscribed to the Google Groups >> "ply-hack" group. >> To post to this group, send email to [email protected]. >> To unsubscribe from this group, send email to >> [email protected]. >> For more options, visit this group at >> http://groups.google.com/group/ply-hack?hl=en. >> > > > > -- > > http://www.voidspace.org.uk/ > > May you do good and not evil > May you find forgiveness for yourself and forgive others > > May you share freely, never taking more than you give. > -- the sqlite blessing http://www.sqlite.org/different.html > > -- > You received this message because you are subscribed to the Google Groups > "ply-hack" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/ply-hack?hl=en. > -- Tarek Ziadé | http://ziade.org -- You received this message because you are subscribed to the Google Groups "ply-hack" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/ply-hack?hl=en.
