[antlr-interest] Antlr missing getTree() method? C#
Gavin Lambert
antlr at mirality.co.nz
Wed Jul 23 15:00:57 PDT 2008
At 08:28 24/07/2008, Setia, Namit wrote:
>For some reason, I don't see any methods to extract the AST
>tree from the parser (i.e., from the "qpar" variable). I've
>seen in other posts people calling qpar.getTree() or
>qpar.program(). Am I missing something critical from my
grammar?
You need to call the top-level rule in your parser. Which in your
case appears to be 'qexprlist'. So call qpar.qexprlist() and
it'll either return the tree directly or the tree will be one of
the members of the structure it returns. (Things vary a little
depending on target and grammar structure, but it's not hard to
work out.)
More information about the antlr-interest
mailing list