[antlr-interest] End of child list in tree parser

David Ray ray at soartech.com
Thu Jan 26 06:57:28 PST 2006


Hello,

In an ANTLR tree parser, is there any special token I can match against 
for "end of child list", kind of like EOF in a non-tree parser?  I'm 
writing a validator for the structure of my AST and I'd like to make 
sure there aren't any trailing nodes.

Something like this:

    formalParameter: #(FORMAL_PARAMETER IDENT IDENT *EOF*)

to ensure there are two and only two IDENT children of FORMAL_PARAMETER.

I know I can manually check getNextSibling() of the last child in a 
rule, but it would be cool if ANTLR did it for me :)

Thanks,
Dave


More information about the antlr-interest mailing list