[antlr-interest] Read grammar, manipulate it, and save changes
researcher0x00 at gmail.com
Sat Dec 17 05:33:32 PST 2011
Off the top of my head, try using toStringTree() which is a method in
BaseTree to convert the AST to text. This will add the ( and ) and spaces
but no line formatting.
You can use toStringTree() as a starting point to write your own method
that adds line formatting.
ANTLR does not have any methods I know of to construct an internal
representation of a tree from a text file.
Hope that helps, Eric
On Fri, Dec 16, 2011 at 10:47 PM, Christian <chwchw at gmx.de> wrote:
> Hi at all,
> I read an antlr-based grammar and produce an AST out of it. After
> manipulating the AST, I now want to save it to a file. But how could I
> do it? Do I have to walk through the AST and manually add parantheses,
> whitespaces and so on? Or does a formatter already exist that I can use?
> I use ANTLR (with the ANTLR 1.6 grammar) to parse the antlr-based
> grammar and to create the AST.
> List: http://www.antlr.org/mailman/listinfo/antlr-interest
More information about the antlr-interest