[antlr-interest] how to create a list of ast nodes correctly?
David Holroyd
dave at badgers-in-foil.co.uk
Sun Nov 25 06:10:12 PST 2007
On Sun, Nov 25, 2007 at 05:26:57AM +0300, v r wrote:
> Hi, i`m building an ast and have a problem with the following rule:
>
> array_declarator_suffix
> : (LEFT_BRACKET constant_expression? RIGHT_BRACKET)+ -> ^(ARRAY_DIM constant_expression?)+
>
> which is meant to define multidimensional arrays.
I've not tried this, but I'd write it something like,
array_declarator_suffix
: LEFT_BRACKET constant_expression? RIGHT_BRACKET
-> ^(ARRAY_DIM constant_expression?)
and then have,
array_declarator_suffix+
at the point of usage.
ta,
dave
--
http://david.holroyd.me.uk/
More information about the antlr-interest
mailing list