[antlr-interest] Bugs generating a tree walker?

Manu manunews at gmail.com
Sun Jan 21 15:07:01 PST 2007


Hi,

The following problems were found using ANTLR 3.05b.

I'm creating a tree walker and I have noticed two strange things:

1) If you create a rule with a return type like this:

genericTypeArgs[int num_params] returns [Type[] types]

the generated code has a return type of Type not Type[]. Is this a bug
or arrays are not supported?

2) With the following rule:

genericTypeArgs[int num_params] returns [Type[] types]:	
^(ARG_LIST (type_names+=typeName)*)

ANTLR gives an error:

error(134): TypeExpressionEval.g:49:69: rule '+=' list labels are not
allowed unless building trees: type_names

However, if I change the rule to return two values:

genericTypeArgs[int num_params] returns [Type[] types, int
aux]:	^(ARG_LIST (type_names+=typeName)*)

it works without changing anything more. Any idea why???

Thanks for the help.


More information about the antlr-interest mailing list