[antlr-interest] adding actions to rules breaks stuff

Benjamin Shropshire shro8822 at vandals.uidaho.edu
Mon Feb 11 15:25:12 PST 2008


Mark Wright wrote:
> Hello Benjamin,
>
> The ANTLR syntax:
>
> import [Object s]
>
> declares rule import as taking a parameter s.  So ANTLR is
> pointing out that when you call it in document, it needs
> to pass it the parameter, something like:
>
> document [Object o]
>      : (i+=import[o])* c+=thing* EOF {o=new Doc($i,o);}
>     ;
Ah!! this looks like it works:

import returns [Object s]


> I strongly recommend buying and reading the ANTLR book.
>
>   
I can't afford it and I don't known if it would be worth having the 
company buy it as I'm still in the "will this be useful stage". A bit of 
a catch-22: can't figure the program out without the book, can't justify 
buying the book without figuring the program out! That's why online docs 
are so important to me!


More information about the antlr-interest mailing list