[stringtemplate-interest] Automatic generation of "StringTemplate"s from antlr grammar?

Terence Parr parrt at cs.usfca.edu
Tue May 3 17:03:51 PDT 2011


Hm...Sound like a nontrivial  problem if you want to do rewrites on the tree and all.
Ter
On Nov 19, 2009, at 2:21 PM, Anthony Anjorin wrote:

> Hi Terence,
>  
> Thanks for the fast reply…
>  
> The problem is that I want to be able to create the textual representation of ANY possible AST based on a given grammar.
> If I understand correctly, one can easily obtain the exact code that has been parsed (parse tree or TokenRewriteStream).
> But how about if I delete or add new nodes (that are of course compatible with the grammar) to the tree (AST as I don’t think I can work directly with the parse tree)?
>  
> The aim here is to parse code, build an AST, perform certain transformations that can radically change the tree (including adding nodes compatible to the grammar but not previously present) and print it out again as code (possibly totally different code but still in the same language as described by the grammar).  All programmes etc. to accomplish this (apart from the transformations on the AST of course) should be generated automatically from the grammar specification.
>  
> Best regards,
> Tony.
>  
>  
>    
> _______________________________________________
> stringtemplate-interest mailing list
> stringtemplate-interest at antlr.org
> http://www.antlr.org/mailman/listinfo/stringtemplate-interest

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/stringtemplate-interest/attachments/20110503/6893f075/attachment.html 


More information about the stringtemplate-interest mailing list