[antlr-interest] Java-lite install?

Ric Klaren ric.klaren at gmail.com
Tue May 3 15:17:27 PDT 2005


Loring Craymer wrote:
> Ric built gcj support into ANTLR starting with 2.7.3.  There should be 
> install notes somewhere in the distribution--it's just a matter of 
> configuring with the proper flags, I believe.

It got lost in the configure/Makefile rework for 2.7.5. I posted an 
updated Makefile a little while ago though (based probably on the one 
mentioned).

Evan Lavelle wrote:
>> I don't use Java at all (and know nothing about it), and was hoping to
>> use ANTLR to generate C++ code, or at least code that I can link with
>> C++ using gcj/gcc.
>>
>> What I've done so far is to download the sources, and to compile them
>> using Luca Di Gaspero's makefile, producing the 'cantlr' executable. I
>> then had a go at running the simple example on the 'Getting started with
>> ANTLR' page. cantlr processes the example grammar file (t.g) correctly,
>> but if I then run 'gcj *.java' I get various error messages along the
>> lines of:
>>
>> L.java:25: error: Class or interface `antlr.SemanticException' not found
>> in import.
>>
>> This class was compiled in by Luca's makefile, and I've got no idea
>> what's going on. Any pointers? Is cantlr all that's required, or do I
>> need to do something else?

You still need the java support library if you want to build from 
generated java files to native parser binaries. I don't think there's a 
Makefile floating around for that case. (It was also not supported in 
the Makefiles from 2.7.4) Basically just grab everything from the antlr 
directory except the swing stuff (the same as with building the native 
antlr binary) make a library of that and link it to the generated 
parser. Or if you use gcj as javac replacement you just have to make a 
jar file from the support lib (the default antlr Makefiles should be 
able to make that for you, then just point to it in the classpath or 
commandline)

>> BTW - I had a go at an RPM installation, but gave up following
>> dependency meltdown.

It often helps to build rebuild from the src.rpm if it's supplied. That 
usually fixes any distribution induced dependencies. (rpmbuild --rebuild 
<the.src.rpm>)

Cheers,

Ric


More information about the antlr-interest mailing list