[antlr-interest] new build

Harald M. Müller harald_m_mueller at gmx.de
Thu Dec 27 15:12:59 PST 2007


Hi Terence -

Here's some feedback on the build from a C# developer ...

it is (at least for me) still hard to build ANTLR from the tar.gz.
Because of the two bugs I sent you in my previous email, I have to rebuild
all of ANTLR. 
However, this is not so easy - here is my "cookbook" of how to create an
ANTLR from your sources - maybe this is also helpful for others.

First, going to the root directory (where build.xml resides) and running ANT
results in

	C:\MyProjects\ANTLR3Explanations\antlr-2007-12-27.12>ant
	Buildfile: build.xml

	generator-prepare:

	generator:
	    [antlr] java.lang.NoClassDefFoundError: antlr/Tool
	    [antlr] Exception in thread "main"

This can be corrected by setting the CLASSPATH explicitly (assuming one runs
ANT from the top-level untar directory):

	set ANTLRLIB=.\lib
	set
CLASSPATH=%ANTLRLIB%\stringtemplate-3.1b1.jar;%ANTLRLIB%\antlr-2.7.7.jar;C:\
eclipse\plugins\org.junit_3.8.1\junit.jar

where junit points to some arbitrary junit installation. Running ANT now
will now produce a host of "duplicate class" errors:

  [myjavac]
C:\MyProjects\ANTLR3Explanations\antlr-2007-12-27.12\codegen\ANTLRLexer.java
:61: duplicate class: org.antlr.tool.ANTLRLexer
  [myjavac] public class ANTLRLexer extends antlr.CharScanner implements
ANTLRTokenTypes, TokenStream
  ...etc. (13 such messages)

At this point, it is necessary to remove the "codegen.dir" from the sources
to be compiled. This is done by removing (or commenting) the line

	<pathelement location="${codegen.dir}" />

in the build.xml file (line 36 in the current build). Now, the compile will
work (interestingly, after this, it is possible to re-insert the line;
because of the lazy compile, everything will work fine from then on, it
seems).

It is now possible to repair the bug in ASTTreeParser.stg and do a final
compile.

Finally, one must copy over the result from build\antlr.jar to
lib\antlr-2007-12-27.12.jar (or the like; if one desires to use the lib dir
as an entry point).

----

Re the C#2.0 runtime, there are a couple more errors in it (although they
are all essentially the same error - using List<T> instead of IList).
There are 4 files which need to be repaired - I have added the repaired
versions as attachments.
(I probably should send you also the grammar with which I found the errors -
but it is currently in a chaotic/experimental state ... maybe I find time
for that in the next days).

Best regards
Harald

> -----Original Message-----
> From: antlr-interest-bounces at antlr.org 
> [mailto:antlr-interest-bounces at antlr.org] On Behalf Of Terence Parr
> Sent: Thursday, December 27, 2007 9:37 PM
> To: Antlr List
> Subject: [antlr-interest] new build
> 
> Hi.  This should behave much better on nasty and large input 
> grammars.  Generated code should be much smaller also (I'm 
> inlining more DFAs).
> 
> http://www.antlr.org/download/build/antlr-2007-12-27.12.tar.gz
> 
> Ter
> 
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: RewriteRuleElementStream.cs
Url: http://www.antlr.org/pipermail/antlr-interest/attachments/20071228/c6f08eb6/attachment-0004.pl 
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: RewriteRuleTokenStream.cs
Url: http://www.antlr.org/pipermail/antlr-interest/attachments/20071228/c6f08eb6/attachment-0005.pl 
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: RewriteRuleSubtreeStream.cs
Url: http://www.antlr.org/pipermail/antlr-interest/attachments/20071228/c6f08eb6/attachment-0006.pl 
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: RewriteRuleNodeStream.cs
Url: http://www.antlr.org/pipermail/antlr-interest/attachments/20071228/c6f08eb6/attachment-0007.pl 


More information about the antlr-interest mailing list