[antlr-interest] stuck on templates

Warner Onstine warnero at gmail.com
Mon Aug 27 11:03:59 PDT 2007


On 8/27/07, Johannes Luber <jaluber at gmx.de> wrote:
> 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.

That grammar comes straight from the CMinus.g file in the v3
downloads. If you want I can attach it, but it seems that those demo
grammars *should* be right. If they aren't they need to be fixed.

-warner

>
> Best regards,
> Johannes Luber
>
>


-- 
Warner Onstine - Programmer/Author
New book on Tapestry 4!
Tapestry 101 available at
http://sourcebeat.com/books/tapestrylive.html
warner at warneronstine.com
http://warneronstine.com/blog


More information about the antlr-interest mailing list