[antlr-interest] Ang: Re: Newbie C-code generation

Johannes Luber JALuber at gmx.de
Wed Jun 18 04:42:32 PDT 2008


> Hmm I'm pretty sure I haven't got a pre installed antlr on my system
> 
> I downloaded the package from http://www.antlr.org/download/antlr-3.1
> b1.tar.gz
> 
> Here is my classpath:
> 
> .;c:\Documents and Settings\qeribra\cgram\cgram\grammars;c:\Documents 
> and Settings\qeribra\antlr\antlr-3.1b1\lib\antlr-3.1b1.jar;c:\Documents 
> and Settings\qeribra\antlr\antlr-3.1b1\lib\antlr-2.7.7.jar;c:\Documents 
> and Settings\qeribra\antlr\antlr-3.1b1\lib\stringtemplate-3.1.jar;c:
> \Documents and Settings\qeribra\antlr\antlr-3.1b1\lib\antlr-runtime-
> current.jar;c:\Documents and Settings\qeribra\antlr\antlr-3.1
> b1\lib\gunit-1.0.2.jar
> 
> 
> When I try to remove the antlr-2.7.7.jar I get the 
> 
> java.lang.NoClassDefFoundError: antlr/Tool
> 
> error.
> 
> I thought the antlr-3.1b1.jar was the new antlr or?

ANTLR 3 is still dependent on ANTLR 2.7.7. Ter plans to change to self-hosting, but that takes longer than expected.

Johannes
> 
> 
> ----Ursprungligt meddelande----
> Från: jimi at temporal-wave.com
> Datum: 2008-jun-17 21:28
> Till: "mimarob at algonet.se"<mimarob at algonet.se>
> Kopia: <antlr-interest at antlr.org>
> Ärende: Re: [antlr-interest] Newbie C-code generation
> 
> On Tue, 2008-06-17 at 11:05 +0200, mimarob at algonet.se wrote:
> 
> > 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?
> 
> 
> 
> You are suing ANTLR 2.7.7 not ANTLR 3, so you cannot generate C code.
> Remove the pre-installed antlr 2 package from your system and download
> the ANTLR 3 atr from the dowloads section of the web site.
> 
> Jim
> 
> 

-- 
Psssst! Schon vom neuen GMX MultiMessenger gehört?
Der kann`s mit allen: http://www.gmx.net/de/go/multimessenger


More information about the antlr-interest mailing list