[antlr-interest] C grammar example from the site

Terence Parr parrt at cs.usfca.edu
Tue Dec 4 12:36:28 PST 2007


On Dec 3, 2007, at 3:58 PM, bbrown wrote:

> I was having trouble generating the C grammar from the site.
>
> "ANSI C grammar for ANTLR v3
> Terence Parr Wed Jul 19, 2006 18:18
> Haven't tested a bunch, but it's a good start. :)"
>
> I downloaded the C.g file and did the following.
>
> LIB1=${LIB}antlr-3.0.1.jar
> LIB2=${LIB}antlr-runtime-3.0.1.jar
> LIB3=${LIB}stringtemplate-3.1b1.jar
> LIBb=${LIB}antlr-2.7.7.jar
>
> java -classpath $CP1 org.antlr.Tool c.g
>
> At this point, things look ok:
>
> ANTLR Parser Generator  Version 3.0.1 (August 13, 2007)
> error(8):  file c.g contains grammar CParser; names must
> warning(200): c.g:455:38: Decision can match input such a
> le alternatives: 1, 2
>
>
> But I don't get a Parser File?  is it supposed to generate a parser  
> so that I
> can process the tokens?

you have changed the file name or the grammar name inside.  Note the  
error message.

Ter


More information about the antlr-interest mailing list