[antlr-interest] stuck on templates
Johannes Luber
jaluber at gmx.de
Mon Aug 27 10:58:57 PDT 2007
Warner Onstine wrote:
> I also tried to do something similar to the CMinus example here:
>
> program
> scope {
> List globals;
> List functions;
> }
> @init {
> $program::globals = new ArrayList();
> $program::functions = new ArrayList();
> }
>
> But when I did that ANTLRWorks first complains about "program" being
> defined already (in the @init section) and it then complains about not
> finding ArrayList (even though I added it in the @header section.
>
> Thanks for any help, just trying to wrap my head around this stuff.
>
> -warner
Is program supposed to be a rule or a scope? The syntax is a mixture of
both. Can you post your grammar here? It would be helpful in finding the
cause and the correct fix.
Best regards,
Johannes Luber
More information about the antlr-interest
mailing list