[antlr-interest] Tree generation qestion
Micheal J
open.zone at virgin.net
Fri Feb 24 16:16:30 PST 2006
> Code generated by the attached grammar only produces a
> root StatementList node contains an empty list of
> Statement. After remove ! from end of
> "statementList", desired result got. Is this normal?
Yes. "!" means don't generate standard tree creation code. You now have to
provide that yourself. For statementList, you should leave it out.
> While the following grammar works well.
>
> formalList!
> :
> (formal ( COMMA! formal)* { ## =
> #(#[FORMAL_LIST,"FORMAL_LIST"],##); })?
> ;
Strange. This should give the root node only as well.
Micheal
More information about the antlr-interest
mailing list