[stringtemplate-interest] Automatic generation of "StringTemplate"s from antlr grammar?
anthony.anjorin at es.tu-darmstadt.de
Thu Nov 19 14:21:00 PST 2009
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.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the stringtemplate-interest