[antlr-interest] Tree grammar/stringtemplate: do I need this?
stevagewp at gmail.com
Sun Jan 20 05:54:54 PST 2008
I've got a medium sized parser for a wiki language which generates a
nice AST. I'd now like to be able to dump out the AST as HTML. Almost
all of the processing and validation has already taken place at this
I thought a tree grammar and string templates would be the way to go.
But according to the book, I should "begin by copying the parser
grammar...and hten altering the header". Eep! Although my parser is
only 760 lines so far, it is bound to grow, and I hate the idea of
having to keep the two parsers synchronised. Also, so much of what
tree grammars do seems redundant for my purposes: there is no "high
level structure" to be validated.
All I really want is something to convert an AST node such as this:
into text like this:
Is there a simpler way?
(I do want to do a small amount of intermediate processing, like
concatenating the children of certain nodes, but maybe that's a
Thanks for any advice!
More information about the antlr-interest