source: release-kits/lirk3/resources/gs3-release-maker/ant/docs/manual/OptionalTasks/antlr.html@ 14982

Last change on this file since 14982 was 14982, checked in by oranfry, 16 years ago

initial import of LiRK3

File size: 5.6 KB
Line 
1<html>
2
3<head>
4<meta http-equiv="Content-Language" content="en-us">
5<title>ANTLR Task</title>
6<link rel="stylesheet" type="text/css" href="../stylesheets/antmanual.css">
7</head>
8
9<body>
10
11<h2><a name="antlr">ANTLR</a></h2>
12<h3>Description</h3>
13<p>
14 Invokes the <a HREF="http://www.antlr.org/" target="_top">ANTLR</a> Translator generator
15 on a grammar file.
16</p>
17<p>
18 To use the ANTLR task, set the <i>target</i> attribute to the name of the
19 grammar file to process. Optionally, you can also set the
20 <i>outputdirectory</i> to write the generated file to a specific directory.
21 Otherwise ANTLR writes the generated files to the directory containing
22 the grammar file.
23</p>
24<p>
25 This task only invokes ANTLR if the grammar file (or the
26 supergrammar specified by the glib attribute) is newer than the
27 generated files.
28</p>
29<p>Antlr 2.7.1 Note:
30<i>
31 To successfully run ANTLR, your best option is probably to build the whole
32 jar with the provided script <b>mkalljar</b> and drop the resulting jar (about 300KB)
33 into ${ant.home}/lib. Dropping the default jar (70KB) is probably not enough
34 for most needs and your only option will be to add ANTLR home directory
35 to your classpath as described in ANTLR <tt>install.html</tt> document.
36</i>
37</p>
38<p>Antlr 2.7.2 Note:
39<i>
40 Instead of the above, you will need antlrall.jar that can be created
41 by the <b>antlr-all.jar</b> target of the Makefile provided with the
42 download.
43</i>
44</p>
45
46<h3>Parameters</h3>
47<table border="1" cellpadding="2" cellspacing="0">
48 <tr>
49 <td valign="top"><b>Attribute</b></td>
50 <td valign="top"><b>Description</b></td>
51 <td align="center" valign="top"><b>Required</b></td>
52 </tr>
53 <tr>
54 <td valign="top">target</td>
55 <td valign="top">The grammar file to process.</td>
56 <td valign="top" align="center">Yes</td>
57 </tr>
58 <tr>
59 <td valign="top">outputdirectory</td>
60 <td valign="top">
61 The directory to write the generated files to. If not set, the files
62 are written to the directory containing the grammar file.
63 </td>
64 <td valign="top" align="center">No</td>
65 </tr>
66 <tr>
67 <td valign="top">glib</td>
68 <td valign="top">
69 An optional super grammar file that the target grammar overrides. This
70 feature is only needed for advanced vocabularies.
71 </td>
72 <td valign="top" align="center">No</td>
73 </tr>
74 <tr>
75 <td valign="top">debug</td>
76 <td valign="top">
77 When set to "yes", this flag adds code to the generated parser that will
78 launch the ParseView debugger upon invocation. The default is "no".
79 <br>
80 Note: ParseView is a separate component that needs to be installed or your
81 grammar will have compilation errors.
82 </td>
83 <td valign="top" align="center">No</td>
84 </tr>
85 <tr>
86 <td valign="top">html</td>
87 <td valign="top">
88 Emit an html version of the grammar with hyperlinked actions.
89 </td>
90 <td valign="top" align="center">No</td>
91 </tr>
92 <tr>
93 <td valign="top">diagnostic</td>
94 <td valign="top">
95 Generates a text file with debugging information based on the target grammar.
96 </td>
97 <td valign="top" align="center">No</td>
98 </tr>
99 <tr>
100 <td valign="top">trace</td>
101 <td valign="top">
102 Forces <b>all</b> rules to call traceIn/traceOut if set to "yes".
103 The default is "no".
104 </td>
105 <td valign="top" align="center">No</td>
106 </tr>
107 <tr>
108 <td valign="top">traceParser</td>
109 <td valign="top">
110 Only forces parser rules to call traceIn/traceOut if set to "yes".
111 The default is "no".
112 </td>
113 <td valign="top" align="center">No</td>
114 </tr>
115 <tr>
116 <td valign="top">traceLexer</td>
117 <td valign="top">
118 Only forces lexer rules to call traceIn/traceOut if set to "yes".
119 The default is "no".
120 </td>
121 <td valign="top" align="center">No</td>
122 </tr>
123 <tr>
124 <td valign="top">traceTreeWalker</td>
125 <td valign="top">
126 Only forces tree walker rules to call traceIn/traceOut if set to
127 "yes". The default is "no".
128 </td>
129 <td valign="top" align="center">No</td>
130 </tr>
131 <!--tr>
132 <td valign="top">fork</td>
133 <td valign="top">Run ANTLR in a separate VM.</td>
134 <td align="center" valign="top">No, default is &quot;off&quot;</td>
135 </tr-->
136 <tr>
137 <td valign="top">dir</td>
138 <td valign="top">The directory to invoke the VM in. <!--(ignored if
139 fork is disabled)--></td>
140 <td align="center" valign="top">No</td>
141 </tr>
142</table>
143
144<h3><a name="nested">Nested Elements</a></h3>
145
146<p><code>ANTLR</code> supports a nested <code>&lt;classpath&gt;</code>
147element, that represents a <a href="../using.html#path">PATH like
148structure</a>. It is given as a convenience if you have to specify
149the original ANTLR directory. In most cases, dropping the appropriate
150ANTLR jar in the normal Ant lib repository will be enough.</p>
151
152<h4>jvmarg</h4>
153
154<p><!--If fork is enabled, -->Additional parameters may be passed to the new
155VM via nested <code>&lt;jvmarg&gt;</code> attributes, for example:</p>
156
157<pre>
158&lt;antlr target="..."&gt;
159 &lt;jvmarg value=&quot;-Djava.compiler=NONE&quot;/&gt;
160 ...
161&lt;/antlr&gt;
162</pre>
163
164<p>would run ANTLR in a VM without JIT.</p>
165
166<p><code>&lt;jvmarg&gt;</code> allows all attributes described in <a
167href="../using.html#arg">Command line arguments</a>.</p>
168
169<h3>Example</h3>
170<blockquote><pre>
171&lt;antlr
172 target=&quot;etc/java.g&quot;
173 outputdirectory=&quot;build/src&quot;
174/&gt;
175</pre></blockquote>
176<p>
177 This invokes ANTLR on grammar file etc/java.g, writing the generated
178 files to build/src.
179</p>
180<hr>
181
182<p align="center">Copyright &copy; 2000-2004 The Apache Software Foundation. All rights
183Reserved.</p>
184
185</body>
186</html>
187
Note: See TracBrowser for help on using the repository browser.