[antlr-interest] manual tree construction
Monty Zukowski
monty at codetransform.com
Fri Sep 16 08:11:50 PDT 2005
Michael Laszlo wrote:
> Thanks Monty. This works:
>
> var_decl!
> : ID DEC_ASSIGN e:expr { #var_decl = #(ID, DEC_ASSIGN, e); }
> ;
>
> It seems necessary to reference expr by label or the resulting parser
> doesn't compile.
>
> The example I modeled it on (from ANTLR Tree Construction) doesn't include
> commas:
>
> begin!
> : INT PLUS i:INT
> { #begin = #(PLUS INT i); }
> ;
>
> (I'm too accustomed to comma-less Scheme lists.)
In fact, tree grammars are written that way too, it's easy to get confused.
Monty
More information about the antlr-interest
mailing list