[antlr-interest] action syntax

brian bsl04 at uark.edu
Wed Nov 23 08:24:19 PST 2005


On Wed, 23 Nov 2005, Akhilesh Mritunjai wrote:

> The solution is:
> typeName: "int" | "char";
> decl:
>    type:typeName name:IDENTIFIER
> {
>    // do whatever
> }
> ;

I wish. But when I do this and try to do something with the variable
'type' within the braces, I always get a compiler error telling me that
'type' is undefined.

This stuff fails with "cannot find symbol" (referring to the variable
'type'):
typeName: "int" | "char";
decl: type:typeName name:IDENTIFIER { System.out.println(type.getText());
};



More information about the antlr-interest mailing list