<html>

<head>
<meta http-equiv="Content-Language" content="en-us">
<title>ANTLR Task</title>
</head>

<body>

<h2><a name="antlr">ANTLR</a></h2>
<h3>Description</h3>
<p>
  Invokes the <a HREF="http://www.antlr.org/" target="_top">ANTLR</a> Translator generator
  on a grammar file.
</p>
<p>
  To use the ANTLR task, set the <i>target</i> attribute to the name of the
  grammar file to process.  Optionally, you can also set the
  <i>outputdirectory</i> to write the generated file to a specific directory.
  Otherwise ANTLR writes the generated files to the directory containing
  the grammar file.
</p>
<p>
  This task only invokes ANTLR if the grammar file is newer than the generated
  files.
</p>
<p>
<i>
  To successfully run ANTLR, your best option is probably to build the whole
  jar with the provided script <b>mkalljar</b> and drop the resulting jar (about 300KB)
  into ${ant.home}/lib. Dropping the default jar (70KB) is probably not enough
  for most needs and your only option will be to add ANTLR home directory
  to your classpath as described in ANTLR <tt>install.html</tt> document.
</i>
</p>

<h3>Parameters</h3>
<table border="1" cellpadding="2" cellspacing="0">
  <tr>
    <td valign="top"><b>Attribute</b></td>
    <td valign="top"><b>Description</b></td>
    <td align="center" valign="top"><b>Required</b></td>
  </tr>
  <tr>
    <td valign="top">target</td>
    <td valign="top">The grammar file to process.</td>
    <td valign="top" align="center">Yes</td>
  </tr>
  <tr>
    <td valign="top">outputdirectory</td>
    <td valign="top">
      The directory to write the generated files to.  If not set, the files
      are written to the directory containing the grammar file.
    </td>
    <td valign="top" align="center">No</td>
  </tr>
  <!--tr>
    <td valign="top">fork</td>
    <td valign="top">Run ANTLR in a separate VM.</td>
    <td align="center" valign="top">No, default is &quot;off&quot;</td>
  </tr-->
  <tr>
    <td valign="top">dir</td>
    <td valign="top">The directory to invoke the VM in. <!--(ignored if
      fork is disabled)--></td>
    <td align="center" valign="top">No</td>
  </tr>
</table>

<h3><a name="nested">Nested Elements</a></h3>

<p><code>ANTLR</code> supports a nested <code>&lt;classpath&gt;</code>
element, that represents a <a href="../using.html#path">PATH like
structure</a>. It is given as a convenience if you have to specify
the original ANTLR directory. In most cases, dropping the appropriate
ANTLR jar in the normal Ant lib repository will be enough.</p>

<h4>jvmarg</h4>

<p><!--If fork is enabled, -->Additional parameters may be passed to the new
VM via nested <code>&lt;jvmarg&gt;</code> attributes, for example:</p>

<pre>
&lt;antlr target=...&gt;
  &lt;jvmarg value=&quot;-Djava.compiler=NONE&quot;/&gt;
  ...
&lt;/antlr&gt;
</pre>

<p>would run ANTLR in a VM without JIT.</p>

<p><code>&lt;jvmarg&gt;</code> allows all attributes described in <a
href="../using.html#arg">Command line arguments</a>.</p>

<h3>Example</h3>
<blockquote><pre>
&lt;antlr
    target=&quot;etc/java.g&quot;
    outputdirectory=&quot;build/src&quot;
/&gt;
</pre></blockquote>
<p>
  This invokes ANTLR on grammar file etc/java.g, writing the generated
  files to build/src.
</p>
<hr>

<p align="center">Copyright &copy; 2001 Apache Software Foundation. All rights
Reserved.</p>

</body>
</html>