ANTLR

Description

Invokes the ANTLR Translator generator on a grammar file.

To use the ANTLR task, set the target attribute to the name of the grammar file to process. Optionally, you can also set the outputdirectory to write the generated file to a specific directory. Otherwise ANTLR writes the generated files to the directory containing the grammar file.

This task only invokes ANTLR if the grammar file is newer than the generated files.

Parameters

Attribute Description Required
target The grammar file to process. Yes
outputdirectory The directory to write the generated files to. If not set, the files are written to the directory containing the grammar file. No
fork Run ANTLR in a separate VM. No, default is "off"
dir The directory to invoke the VM in. (ignored if fork is disabled) No

Example

<antlr
    target="etc/java.g"
    outputdirectory="build/src"
/>

This invokes ANTLR on grammar file etc/java.g, writing the generated files to build/src.