[antlr-interest] generating root nodes in tree parser

Martin Probst mail at martin-probst.com
Tue Jul 12 10:40:25 PDT 2005


> the ## creates new node

## identifies the current rule, it's a shorthand for writing
#functionCall. By assigning to it you define the "return value" of the
parser rule.

> The new node is specified using the #(...) syntax...

#( ) actually defines a subtree, first element is the rule, following
elements are children.

> #[CALL , 'function call'] creates the root node and gives it a label too.
> #id would and #pl then become the children..

Yes, exactly.

> Is there a source where I can find out about such syntax? Something that 
> I can check before firing a questin on ANTLR mailing list?

Well, there is the ANTLR Manual, both as an HTML version and a much more
accessible PDF (IMHO). But some stuff just isn't mentioned in there.

Keep in mind that wha I've written is only valid for ANTLR 2.x, the
syntax is different for the experimental 3.x version as Terr has pointed


More information about the antlr-interest mailing list