[antlr-interest] flat AST tree

Gavin Lambert antlr at mirality.co.nz
Sun Aug 24 04:45:33 PDT 2008


At 23:32 24/08/2008, Torsten Curdt wrote:
 >Well, of course there is an implicit hierarchy
 >
 >  ruleA: ruleB;
 >
 >  ruleB: ruleC;
 >
 >Is basically:
 >
 >  ruleA -> ruleB -> ruleC
 >
 >That is what ANTLRWorks is displaying and that is what I 
expected
 >the AST to be. That it might not be the desired final structure 
-
 >but that's a different thing.

That's a parse tree, though, not an AST.  An AST can only be built 
from tokens, and parser rules aren't tokens.

I think there actually is a way to get ANTLR to generate a parse 
tree in normal (non-AST) mode, but I can't remember the 
specifics.  There might be something on the wiki.



More information about the antlr-interest mailing list