[antlr-interest] Creating AST with third party grammar
John B. Brodie
jbb at acm.org
Mon Feb 8 15:42:23 PST 2010
On Mon, 2010-02-08 at 14:58 -0800, tahiti wrote:
> Please, repply on the simple question: how access to generated ast? The
> documantation for 3.0 a thery uggly and don't contains necessary
> information. I know how to do it in the version 2.0 (there are method
> getAST() in Parser class), but this method removed in version 3.0!
If you look closely at the source code generated by the Tool for your
parser --- and it is one of the strengths of ANTLR that you can actually
read and debug the generated code --- you will see that each Parser in
your grammar has a corresponding method in the generated source code.
And that method has a return type of a structure one of whose fields is
`tree`, the AST generated by that rule.
Hope this helps...
More information about the antlr-interest