[antlr-interest] antlrworks interpreter like serialized parse tree

Gavin Lambert antlr at mirality.co.nz
Mon Jan 25 12:14:59 PST 2010


At 01:17 26/01/2010, Candide Kemmler wrote:
 >I love the parse tree representation that antlrWorks presents 
and
 >getting such a structure would be ideal for my use case. However 
I
 >can't seem to find a way to create a similar representation of 
the
 >parse tree using the API.

Normally you don't really want to generate the parse tree as shown 
in ANTLRworks -- that's purely a debugging aid.  For production 
use you're better off generating an AST instead; this way you have 
more control over the output and you can (among other things) 
refactor your parser without altering the output if you want to.

See the output=AST option and the various example grammars, wiki 
pages, and book chapters about AST construction.



More information about the antlr-interest mailing list