Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 5.3

...

  1. Make sure antlr2, antlr3, ST are in classpath. All in one is here:

    http://antlr.org/download/antlr-3.3-complete.jar

  2. For a quick check if ANTLR3 can be found via classpath, copy the following lines into a file named build.xml:

    Code Block
    borderColorblue
    bgColornone
    borderWidth1
    borderStyledashed
    langactionscript
    borderStyledashed
    <project name="antlr3_and_ant" default="antlr_classpath" basedir=".">
    
    <!-- Check if ANTLR3 can be found in the classpath -->
    <target name="antlr_classpath">
    <whichresource property="antlr.in.classpath" class="org.antlr.Tool" />
    <fail message="ANTLR3 not found via CLASSPATH ${java.class.path}">
    <condition>
    <not>
    <isset property="antlr.in.classpath"/>
    </not>
    </condition>
    </fail>
    <echo>ANTLR3 found via CLASSPATH</echo>
    </target>
    
    </project>
    

    Execute ant in the directory you saved the build.xml file in:

    Code Block
    borderColorblue
    bgColornone
    borderWidth1
    borderStylesolid
    langactionscript
    borderStylesolid
    $ ant
    

    The ant command should result in some output similar to that shown below:

    Code Block
    borderColorblue
    bgColorlightgrey
    borderWidth1
    borderStylesolid
    langactionscript
    borderStylesolid
    Buildfile: F:/tmp/build.xml
    
    antlr_classpath:
    [echo] ANTLR3 found via CLASSPATH
    
    BUILD SUCCESSFUL
    Total time: 0 seconds
    

    In case ANTLR3 is not contained in the class path, the build will fail. To convince you that ANLTR3 is not part of the CLASSPATH, the complete CLASSPATH visible to ant is printed.

    Code Block
    borderColorblue
    bgColorlightgrey
    borderWidth1
    borderStylesolid
    langactionscriptborderStylesolid
    Buildfile: F:/tmp/build.xml
    
    antlr_classpath:
    
    BUILD FAILED
    F:/tmp/build.xml:6: ANTLR3 not found via CLASSPATH
    F:/apache-ant-1.8.2/lib/ant-launcher.jar;F:\apache-ant-1.8.2\lib\ant-antlr.jar;...;C:\Programme\Java\jdk1.6.0_17\lib\tools.jar
    
    Total time: 0 seconds
    

...

Code Block
borderColorblue
bgColornone
borderWidth1
borderStylesolid
langactionscript
borderStylesolid
$ java org.antlr.Tool -verbose -o . CMinus.g

...

Code Block
borderStyle
borderColorblue
bgColornone
borderWidth1
borderStyledashed
langactionscriptdashed
<project name="cminus" default="antlr" basedir=".">

<!-- Antlr3 is called here -->
<!-- java org.antlr.Tool -verbose -o . CMinus.g -->
<target name="antlr">
<java classname="org.antlr.Tool" fork="true" failonerror="true">
<arg value="-verbose"/>
<arg value="-o"/>
<arg path="."/>
<arg path="CMinus.g"/>
</java>
</target>

</project>

...

Code Block
borderColorblue
bgColornone
borderWidth1
borderStylesolid
langactionscript
borderStylesolid
$ ant


 This should give the following result:

Code Block
borderStyle
borderColorblue
bgColorlightgrey
borderWidth1
borderStylesolid
langactionscriptsolid
Buildfile: F:\examples-v3\java\cminus\build.xml

antlr:
[java] ANTLR Parser Generator Version 3.3 Nov 30, 2010 12:50:56
[java] F:\examples-v3\java\cminus\CMinus.g

BUILD SUCCESSFUL
Total time: 2 seconds

...

Code Block
borderStyle
borderColorblue
bgColornone
borderWidth1
borderStylesolid
langactionscriptsolid
$ java org.antlr.Tool


The next step is to compile the ANLTR3 generated Java-files. We already assured that ANTLR3 is contained in the CLASSPATH in the last chapter.

Code Block
borderColorblue
bgColornone
borderWidth1
borderStyledashed
langactionscriptborderStyledashed
<project name="cminus" default="compile" basedir=".">

<!-- Antlr3 is called here -->
<!-- java org.antlr.Tool -verbose -make -o . CMinus.g -->
<target name="antlr">
<java classname="org.antlr.Tool" fork="true" failonerror="true">
<arg value="-verbose"/>
<arg value="-make"/>
<arg value="-o"/>
<arg path="."/>
<arg path="CMinus.g"/>
</java>
</target>

<target name="compile" depends="antlr" description="compile">
<javac srcdir="."
destdir="."
deprecation="Yes"
listfiles="Yes"
includeantruntime="false">
<classpath>
<pathelement path="${java.class.path}"/>
</classpath>
</javac>
</target>

</project>

...

Code Block
borderColorblue
bgColorlightgrey
borderWidth1
borderStylesolid
langactionscript
borderStylesolid
Buildfile: F:\examples-v3\java\cminus\build.xml

antlr:
[java] ANTLR Parser Generator Version 3.3 Nov 30, 2010 12:50:56
[java] F:\examples-v3\java\cminus\CMinus.g

compile:
[javac] Compiling 2 source files to F:\examples-v3\java\cminus
[javac] F:\examples-v3\java\cminus\CMinusLexer.java
[javac] F:\examples-v3\java\cminus\CMinusParser.java
[javac] Note: F:\examples-v3\java\cminus\CMinusParser.java uses unchecked or unsafe operations.
[javac] Note: Recompile with -Xlint:unchecked for details.

BUILD SUCCESSFUL
Total time: 6 seconds

...

Code Block
borderColorblue
bgColorlightgrey
borderWidth1
borderStylesolid
langactionscript
borderStylesolid
Buildfile: F:\examples-v3\java\cminus\cminus.xml

antlr:
[java] ANTLR Parser Generator Version 3.3 Nov 30, 2010 12:50:56
[java] Grammar F:\examples-v3\java\cminus\CMinus.g is up to date - build skipped

compile:

BUILD SUCCESSFUL
Total time: 1 second

...

Code Block
borderColorblue
bgColornone
borderWidth1
borderStyledashed
langactionscriptborderStyledashed
<project name="polydiff" default="compile" basedir=".">

<!-- An ant macro which invokes ANTLR3
This is just a parameterizable wrapper to simplify the invocation of ANTLR3.
The default values can be overriden by assigning a value to an attribute
when using the macro.
Example with ANTLR3 outputdirectory modified:
<antlr3 grammar.name="CMinus.g" outputdirectory="${src}/${package}"/>
-->
<macrodef name="antlr3">
<attribute name="grammar.name"/>
<attribute name="outputdirectory" default="."/>
<attribute name="libdirectory" default="."/>
<sequential>
<java classname="org.antlr.Tool" fork="true" failonerror="true">
<arg value="-o"/>
<arg path="@{outputdirectory}"/>
<arg value="-lib"/>
<arg path="@{libdirectory}"/>
<arg value="-verbose"/>
<arg value="-Xmultithreaded"/>
<arg value="-make"/>
<arg path="@{grammar.name}"/>
</java>
</sequential>
</macrodef>

<target name="PolyPrinter" depends="Simplifier">
<antlr3 grammar.name="PolyPrinter.g" />
</target>
<target name="Simplifier" depends="PolyDifferentiator">
<antlr3 grammar.name="Simplifier.g" />
</target>
<target name="PolyDifferentiator" depends="Poly">
<antlr3 grammar.name="PolyDifferentiator.g" />
</target>
<target name="Poly">
<antlr3 grammar.name="Poly.g" />
</target>

<target name="compile" depends="PolyPrinter" description="compile">
<javac srcdir="." destdir="."
listfiles="Yes" deprecation="Yes">
<compilerarg value="-Xlint:unchecked"/>
<classpath>
<pathelement path="${java.class.path}"/>
</classpath>
</javac>
</target>

</project>

...

Code Block
borderColorblue
bgColornone
borderWidth1
borderStyledashed
langactionscript
borderStyledashed
...
<!-- where to place the antlr generated files -->
<property name="src" location="src"/>
<!-- name of the package -->
<property name="package" value=""/>
<!-- where to find the grammar files -->
<property name="grammar" location="grammar"/>
<!-- where to write/find token files -->
<property name="token.lib" location="${src}/${package}" />

<macrodef name="antlr3">
<attribute name="grammar.name"/>
<attribute name="package" default="${package}"/>
<sequential>
<echo message="antlr ${grammar}/@{grammar.name}" />
<!-- Antlr3 is called here -->
<java classname="org.antlr.Tool" fork="true" failonerror="true">
<jvmarg value="-Xmx512M"/>
<arg value="-o"/>
<arg path="${src}/${package}"/>
<arg value="-lib"/>
<arg path="${src}/${package}"/>
<arg value="-verbose"/>
<arg value="-report"/>
<arg value="-Xmultithreaded"/>
<arg value="-make"/>
<arg path="${grammar}/@{grammar.name}"/>
<classpath>
<pathelement path="${run.classpath}"/>
</classpath>
</java>
</sequential>
</macrodef>

<!-- Modify here. Adapt the dependencies for your grammar(s).
Watch out to specify the dependencies in the correct order!
The sequence in which the grammars are compiled by Antlr in
this example:
1: Poly.g as PolyDifferentiator depends on it
2: PolyDifferentiator as Simplifier dependends on it
3: Simplifier.g as PolyPrinter dependends on it
4: PolyPrinter.g
-->
<target name="-pre-compile" depends="PolyPrinter"/>
<target name="PolyPrinter" depends="Simplifier">
<antlr3 grammar.name="PolyPrinter.g"/>
</target>
<target name="Simplifier" depends="PolyDifferentiator">
<antlr3 grammar.name="Simplifier.g"/>
</target>
<target name="PolyDifferentiator" depends="Poly">
<antlr3 grammar.name="PolyDifferentiator.g"/>
</target>
<target name="Poly">
<antlr3 grammar.name="Poly.g"/>
</target>

</project>

...

  1. Download ant-antlr3 task from

    http://www.antlr.org/share/1169924912745/antlr3-task.zip

  2. Copy the antlr3-task.zip file to a convenient temporary location. e.g /tmp and unpack the archive

    Code Block
    borderColorblue
    bgColornone
    borderWidth1
    borderStylesolid
    langactionscriptborderStylesolid
    $unzip antlr3-task.zip

    The directory structure unveiled should look like this:

    Code Block
    borderColorblue
    bgColorlightgrey
    borderWidth1
    borderStylesolid
    langactionscript
    borderStylesolid
    directory antlr3-src 'source code of the utility
    directory examples 'some example build files on how to use the ant-antlr3 task
    file ant-antlr3.jar 'the ant task for antlr3
    file antlr3-task.doc 'some short documentation (Word-Document)
    file antlr3-task.htm 'some short documentation (HTML-Document)
    file Readme.txt 'history of changes and a few hints
    

  3. Make ant-antlr3.jar visible to ant. The recommended way to achieve this, is to copy the ant-antlr3.jar into your $ANT_HOME/lib directory.

    Assuming apache-ant-1.8.2 is installed in /usr/local, you might proceed as shown below:

    Code Block
    borderColorblue
    bgColornone
    borderWidth1
    borderStylesolid
    langactionscriptborderStylesolid
    $ sudo cp /tmp/ant-antlr3.jar /usr/local/apache-ant-1.8.2/lib/
    

    Check that the antlib ant-antlr3.jar is correctly recognized by ant:

    Code Block
    borderStyle
    borderColorblue
    bgColornone
    borderWidth1
    borderStylesolid
    langactionscriptsolid
    $ ant -diagnostics
    

    should show:

    Code Block
    borderColorblue
    bgColorlightgrey
    borderWidth1
    borderStylesolid
    langactionscriptborderStylesolid
    \------------------------------------------\-
    ANT_HOME/lib jar listing
    \------------------------------------------\-
    ant.home: /usr/share/ant
    ant-antlr.jar (5758 bytes)
    ant-antlr3.jar (20.889 bytes) <--------\-
    ...
    

    Make sure that antlr-3.3-complete.jar is contained in the classpath. The same #prerequisites have to be fulfilled and should be checked as described before.

...

Code Block
borderColorblue
bgColornone
borderWidth1
borderStyledashed
langactionscript
borderStyledashed
<project name="cminus" default="antlr" basedir=".">

<!-- Antlr3 is called here -->
<target name="antlr">
<antlr:ant-antlr3 xmlns:antlr="antlib:org/apache/tools/ant/antlr"
verbose="true"
outputdirectory="."
target="CMinus.g"/>
</target>

</project>

...

Code Block
borderColorblue
bgColornone
borderWidth1
borderStylesolid
langactionscript
borderStylesolid
$ ant


 This should give the following result:

Code Block
borderColorblue
bgColorlightgrey
borderWidth1
borderStylesolid
langactionscript
borderStylesolid
Buildfile: F:\examples-v3\java\cminus\build.xml

antlr:
[antlr:ant-antlr3] F:\examples-v3\Java\cminus\CMinus.g
[antlr:ant-antlr3] ANTLR Parser Generator Version 3.3 Nov 30, 2010 12:50:56

BUILD SUCCESSFUL
Total time: 3 seconds

...

Code Block
borderColorblue
bgColornone
borderWidth1
borderStyledashed
langactionscriptborderStyledashed
<project name="cminus" default="compile" basedir=".">

<!-- Antlr3 is called here -->
<target name="antlr">
<antlr:ant-antlr3 xmlns:antlr="antlib:org/apache/tools/ant/antlr"
verbose="true"
outputdirectory="."
target="CMinus.g"/>
</target>

<target name="compile" depends="antlr" description="compile">
<javac srcdir="."
destdir="."
deprecation="Yes"
listfiles="Yes"
includeantruntime="false">
<classpath>
<pathelement path="${java.class.path}"/>
</classpath>
</javac>
</target>

</project>

...

Code Block
borderColorblue
bgColorlightgrey
borderWidth1
borderStylesolid
langactionscript
borderStylesolid
Buildfile: F:\examples-v3\java\cminus\build.xml

antlr:
[antlr:ant-antlr3] ANTLR Parser Generator Version 3.3 Nov 30, 2010 12:50:56
[antlr:ant-antlr3] F:\examples-v3\Java\cminus\CMinus.g

compile:
[javac] Warning: CMinus.tokens modified in the future.
[javac] Warning: CMinusLexer.java modified in the future.
[javac] Compiling 2 source files to F:\examples-v3\Java\cminus
[javac] F:\examples-v3\Java\cminus\CMinusLexer.java
[javac] F:\examples-v3\Java\cminus\CMinusParser.java
[javac] Note: F:\examples-v3\Java\cminus\CMinusParser.java uses unchecked or unsafe operations.
[javac] Note: Recompile with -Xlint:unchecked for details.

BUILD SUCCESSFUL
Total time: 9 seconds

...

Code Block
borderColorblue
bgColornone
borderWidth1
borderStyledashed
langactionscript
borderStyledashed
<project name="polydiff" default="compile" basedir=".">

<!-- An ant macro which invokes antlr3
This is just a parameterizable wrapper to simplify the invocation of ANTLR3.
The default values can be overriden by assigning a value to an attribute
when using the macro.
Example with ANTLR3 debug option activated and the outputdirectory modified:
<antlr3 grammar.name="CMinus.g" outputdirectory="${src}/${package}" debug="true"/>
-->
<macrodef name="antlr3">
<attribute name="grammar.name"/>
<attribute name="outputdirectory" default="."/>
<attribute name="libdirectory" default="."/>
<attribute name="multithreaded" default="true"/>
<attribute name="verbose" default="true"/>
<attribute name="report" default="true"/>
<attribute name="debug" default="false"/>
<sequential>
<antlr:ant-antlr3 xmlns:antlr="antlib:org/apache/tools/ant/antlr"
target="@{grammar.name}"
outputdirectory="@{outputdirectory}"
libdirectory="@{libdirectory}"
multithreaded="@{multithreaded}"
verbose="@{verbose}"
report="@{report}"
debug="@{debug}">
<classpath>
<pathelement path="${java.class.path}"/>
</classpath>
<jvmarg value="-Xmx512M"/>
</antlr:ant-antlr3>
</sequential>
</macrodef>

<!-- ANTLR3 is called here -->
<!-- The dependency among grammars has to be defined by the invocation sequence -->
<!-- The hierarchy in this example is:

Poly.g
- PolyDifferentiator.g
- Simplifier.g
- PolyPrinter.g

The dependency is described from bottom to top:

PolyPrinter.g depends from
- Simplifier.g depends from
- PolyDifferntiator.g depends from
- Poly.g

Note that Antlr is only invoked when necessary, e.g.
changes in PolyDifferentiator.g do not result in
Poly.g being recompiled. Only Simplifier.g and
PolyPrinter.g might be affected.
Call "ant" without parameters twice and you will
notice that no compilation by Antlr is done.
-->

<target name="PolyPrinter" depends="Simplifier">
<antlr3 grammar.name="PolyPrinter.g"/>
</target>
<target name="Simplifier" depends="PolyDifferentiator">
<antlr3 grammar.name="Simplifier.g"/>
</target>
<target name="PolyDifferentiator" depends="Poly">
<antlr3 grammar.name="PolyDifferentiator.g"/>
</target>
<target name="Poly">
<antlr3 grammar.name="Poly.g"/>
</target>

<target name="compile" depends="PolyPrinter" description="compile">
<javac srcdir="."
destdir="."
deprecation="Yes"
listfiles="Yes"
includeantruntime="false">
<compilerarg value="-Xlint:unchecked"/>
<classpath>
<pathelement path="${java.class.path}"/>
</classpath>
</javac>
</target>

</project>

...

Code Block
borderColorblue
bgColorlightgrey
borderWidth1
borderStylesolid
langactionscriptborderStylesolid
Buildfile: F:\examples-v3\Java\polydiff\build.xml

Poly:
[antlr:ant-antlr3] Failed to change file modification time
[antlr:ant-antlr3] ANTLR Parser Generator Version 3.3 Nov 30, 2010 12:50:56
[antlr:ant-antlr3] F:\examples-v3\Java\polydiff\Poly.g
[antlr:ant-antlr3] two-threaded DFA conversion
[antlr:ant-antlr3] Poly.poly:5:22 decision 1: k=1
[antlr:ant-antlr3] Poly.term:8:5 decision 2: k=3
[antlr:ant-antlr3] two-threaded DFA conversion

PolyDifferentiator:
[antlr:ant-antlr3] F:\examples-v3\Java\polydiff\PolyDifferentiator.g
[antlr:ant-antlr3] ANTLR Parser Generator Version 3.3 Nov 30, 2010 12:50:56
[antlr:ant-antlr3] warning(138): F:\examples-v3\Java\polydiff\PolyDifferentiator.g:0:0: grammar PolyDifferentiator: no start rule (no rule can obviously be followed by EOF)
[antlr:ant-antlr3] two-threaded DFA conversion
[antlr:ant-antlr3] PolyDifferentiator.poly:9:5 decision 1: k=4

Simplifier:
[antlr:ant-antlr3] ANTLR Parser Generator Version 3.3 Nov 30, 2010 12:50:56
[antlr:ant-antlr3] F:\examples-v3\Java\polydiff\Simplifier.g
[antlr:ant-antlr3] two-threaded DFA conversion
[antlr:ant-antlr3] Simplifier.poly:15:5 decision 1: k=1 backtracks

PolyPrinter:
[antlr:ant-antlr3] F:\examples-v3\Java\polydiff\PolyPrinter.g
[antlr:ant-antlr3] ANTLR Parser Generator Version 3.3 Nov 30, 2010 12:50:56
[antlr:ant-antlr3] warning(138): F:\examples-v3\Java\polydiff\PolyPrinter.g:0:0: grammar PolyPrinter: no start rule (no rule can obviously be followed by EOF)
[antlr:ant-antlr3] two-threaded DFA conversion
[antlr:ant-antlr3] PolyPrinter.poly:8:5 decision 1: k=1

compile:
[javac] Compiling 6 source files to F:\examples-v3\Java\polydiff
[javac] F:\examples-v3\Java\polydiff\Main.java
[javac] F:\examples-v3\Java\polydiff\PolyDifferentiator.java
[javac] F:\examples-v3\Java\polydiff\PolyLexer.java
[javac] F:\examples-v3\Java\polydiff\PolyParser.java
[javac] F:\examples-v3\Java\polydiff\PolyPrinter.java
[javac] F:\examples-v3\Java\polydiff\Simplifier.java
[javac] F:\examples-v3\Java\polydiff\PolyPrinter.java:49: warning: [unchecked] unchecked call to put(K,V) as a member of the raw type java.util.HashMap
[javac] super.put(attrName, value);
[javac] ^
[javac] F:\examples-v3\Java\polydiff\PolyPrinter.java:53: warning: [unchecked] unchecked call to put(K,V) as a member of the raw type java.util.HashMap
[javac] super.put(attrName, new Integer(value));
[javac] ^
[javac] 2 warnings

BUILD SUCCESSFUL
Total time: 16 seconds

...

Code Block
borderColorblue
bgColorlightgrey
borderWidth1
borderStylesolid
langactionscriptborderStylesolid
Buildfile: F:\examples-v3\java\polydiff\buildantlr1.xml

Poly:

PolyDifferentiator:

Simplifier:

PolyPrinter:

compile:

BUILD SUCCESSFUL
Total time: 6 seconds

...

Code Block
borderColorblue
bgColornone
borderWidth1
borderStyledashed
langactionscript
borderStyledashed
...
<!-- where to place the antlr generated files -->
<property name="src" location="src"/>
<!-- name of the package -->
<property name="package" value=""/>
<!-- where to find the grammar files -->
<property name="grammar" location="grammar"/>
<!-- where to write/find token files -->
<property name="token.lib" location="${src}/${package}" />

<!-- where to place the antlr generated files -->
<property name="src" location="src"/>
<!-- name of the package -->
<property name="package" value=""/>
<!-- where to find the grammar files -->
<property name="grammar" location="grammar"/>
<!-- where to write/find token files -->
<property name="token.lib" location="${src}/${package}" />

<!-- a convenience macro which invokes antlr -->
<macrodef name="antlr3">
<attribute name="grammar.name"/>
<attribute name="package" default="${package}"/>
<attribute name="multithreaded" default="True"/>
<attribute name="verbose" default="True"/>
<attribute name="debug" default="False"/>
<sequential>
<echo message="antlr ${grammar}/@{grammar.name}" />
<antlr:ant-antlr3 xmlns:antlr="antlib:org/apache/tools/ant/antlr"
target="${grammar}/@{grammar.name}"
outputdirectory="${src}/@{package}"
libdirectory="${src}/@{package}"
multithreaded="@{multithreaded}"
verbose="@{verbose}"
debug="@{debug}">
<classpath>
<pathelement path="${javac.classpath}"/>
</classpath>
</antlr:ant-antlr3>
</sequential>
</macrodef>

<!-- Modify here. Adapt the dependencies for your grammar(s).
Watch out to specify the dependencies in the correct order!
The sequence in which the grammars are compiled by Antlr in
this example:
1: Poly.g as PolyDifferentiator depends on it
2: PolyDifferentiator as Simplifier dependends on it
3: Simplifier.g as PolyPrinter dependends on it
4: PolyPrinter.g
-->
<target name="-pre-compile" depends="PolyPrinter"/>
<target name="PolyPrinter" depends="Simplifier">
<antlr3 grammar.name="PolyPrinter.g"/>
</target>
<target name="Simplifier" depends="PolyDifferentiator">
<antlr3 grammar.name="Simplifier.g"/>
</target>
<target name="PolyDifferentiator" depends="Poly">
<antlr3 grammar.name="PolyDifferentiator.g"/>
</target>
<target name="Poly">
<antlr3 grammar.name="Poly.g"/>
</target>

</project>

...

Code Block
borderColorblue
bgColornone
borderWidth1
borderStyledashed
langactionscript
borderStyledashed
<project name="anltr3" default="antlr_libdir" basedir=".">

<!-- Inquire environment variables -->
<property environment="envList"/>

<!-- Get environment variable ANTLR_LIBDIR -->
<property name="antlrLibDir" value="${envList.ANTLR_LIBDIR}"/>

<!-- Check if ANTLR_LIBDIR environment variable is set -->
<condition property="antlrLibDir.isset">
<isset property="envList.ANTLR_LIBDIR"/>
</condition>

<target name="antlr_libdir">
<fail message="ANTLR_LIBDIR environment variable not defined">
<condition>
<not>
<isset property="antlrLibDir.isset"/>
</not>
</condition>
</fail>

<whichresource property="antlr.jar.location" class="org.antlr.Tool" classpathref="antlr.path"/>
<fail message="Antlr library not found via ANTLR_LIBDIR='${antlrLibDir}'">
<condition>
<not>
<isset property="antlr.jar.location"/>
</not>
</condition>
</fail>
<echo>ANTLR3 found via environment variable ANTLR_LIBDIR: ${antlr.jar.location}</echo>
</target>

<!-- Use wildcards in pattern definition -->
<!-- to be independent of antlr versions -->
<patternset id="antlr.libs">
<include name="antlr-*.jar" />
</patternset>

<!-- Looking for archives in ANTLR_LIBDIR -->
<path id="antlr.path">
<fileset dir="${antlrLibDir}" casesensitive="yes">
<patternset refid="antlr.libs" />
</fileset>
</path>

</project>

...

Code Block
borderColorblue
bgColornone
borderWidth1
borderStyledashed
langactionscriptborderStyledashed
<project name="anltr3" default="compile" basedir=".">
...

<!-- Antlr3 is called here -->
<target name="antlr">
<antlr:ant-antlr3 xmlns:antlr="antlib:org/apache/tools/ant/antlr"
verbose="true"
outputdirectory="."
target="CMinus.g">
<classpath>
<path refid="antlr.path"/>
</classpath>
<jvmarg value="-Xmx512M"/>
</target>

<target name="compile" depends="antlr" description="compile">
<javac srcdir="."
destdir="."
deprecation="Yes"
listfiles="Yes"
includeantruntime="false">
<compilerarg value="-Xlint:unchecked"/>
<classpath>
<path refid="antlr.path"/>
</classpath>
</javac>
</target>

</project>

...