RE: »Ø¸´£º RE: [antlr-interest] question about csharp_v1 example

Micheal J open.zone at virgin.net
Thu Jul 27 08:16:13 PDT 2006


Robert,

> Hi, 
> I downloaded NAnt, but I got error--
> 
> D:\antlr-2.7.6\examples\csharp\csharp_v1>nant
> NAnt 0.85 (Build 0.85.2344.0; rc4; 2006-6-2)
> Copyright (C) 2001-2006 Gerry Shaw
> http://nant.sourceforge.net
> 
> Buildfile: 
> file:///D:/antlr-2.7.6/examples/csharp/csharp_v1/csharp_v1.build
> Target framework: Microsoft .NET Framework 2.0
> Target(s) specified: test
> 
>    [tstamp] 2006年7月27日 15:33:05.
>      [echo] Building project: 'CSharp v1 Grammar Sample for ANTLR'
> 
> generate:
> 
>      [exec] java.lang.NoClassDefFoundError: antlr/Tool
>      [exec] Exception in thread "main"

This says "I couldn't find the Tool.class file in D:\antlr-2.7.6\antlr"

You should build antlr itself first.


If you can't (or won't) build antlr, make the following changes to the *original* csharp_v1.build

1. Find this line:
	    <property name="antlr.dir" value="..\..\.."/>

  Add the following below it:
	    <property name="antlr.cp" value="..\..\..\antlr.jar"/>


2. Find this line:
    <target name="generate" description="calls ANTLR to generate Lexers/Parsers">    	

   Change all occurences of ${antlr.dir} IN THIS TARGET ONLY (i.e. between <target ..> and the closing </target>) to:
	${antlr.cp}

This changes basically say, "use the version of the antlr .class files found in antlr.jar". Consequently. any changes you've made to your local copy of the antlr tool's sources would not be reflected here obviously.

> In csharp_v1.build, I also replaced "antlr.Tool" with 
> "antlr.jar antlr.Tool ", it ends the same.

Don't do this  ;-)

Micheal

-----------------------
The best way to contact me is via the list/forum. My time is very limited.



More information about the antlr-interest mailing list