[antlr-interest] Output graph of parse-tree - without ANTLRWorks?

Søren Andersen soren.andersen at gmail.com
Sun Feb 14 15:13:19 PST 2010


Hi,

I've recently been playing with the java 1.6 grammar found on the ANTLR homepage, trying to modify it for my needs.
However, I've run into a problem with expressions of the type
foo.bar().baz
where my modified grammar cannot handle it, while the original can.

However, the complexity of the original makes it less than desirable to wade trough it, trying to figure out how to it parses the example above.

Normally, I'd just plug it into ANTLRWorks and see there, but it doesn't seem to work - ANTLRWorks produces a graph with "can't deal with predicates yet" in it, and I cannot remove the predicates as they make the grammar ambiguous.

Thus, the way I see it, my only option is to somehow output the parse-tree programatically.

I've already got a small script running that parses an external file, but it doesn't produce a parse tree, and I've been unable to find any code that does.

It's not necessary it be as nice as the ones in ANTLRWorks. Basically, if I can see which rules are invoked in a small example it'd be fine for my needs.

Thanks for you advice in advance!

Regards,

Søren Andersen


More information about the antlr-interest mailing list