[antlr-interest] Newbie C-code generation

mimarob at algonet.se mimarob at algonet.se
Tue Jun 17 02:05:18 PDT 2008


Hello!

I just installed 3.0.1 antlr and also a daily build from 2008-05-25

I then took some example code (cgram.tgz sorry dont know which 
version) 

The cgram examples work great (ok I had to remove some silly  import 
CToken; stuff but that 
was all)

Then I wanted to generate C-code instead of java so I added language 
to the options section in
the GnuCParser.g file :

options {

   language=C;

        k = 2;
        exportVocab = GNUC;
        buildAST = true;

...
}



$ make
java antlr.Tool StdCParser.g
ANTLR Parser Generator   Version 2.7.7 (20060906)   1989-2005

.... lots of antlr output...

StdCParser.g:1354:     k==3:<end-of-token>,'\u0000'..'\u00ff'
StdCParser.g:1354:     between alt 4 and exit branch of block
java antlr.Tool -glib "StdCParser.g" GnuCParser.g
ANTLR Parser Generator   Version 2.7.7 (20060906)   1989-2005
.\expandedGnuCParser.g:15:0: Invalid option: language
Exiting due to errors.
make: *** [GnuCParser.java] Error 1


Do I need to add the C generation module someway?

Do I need to recompile antlr myself for this to work?

I also tried with 

language=Java;

producing the same result

I tried two java releases, jdk1.6.0_06 and j2sdk1.4.2_16 also with the 
same result

Any ideas?





More information about the antlr-interest mailing list