[antlr-interest] ant & antlr
Matthew Ford
Matthew.Ford at forward.com.au
Sat Jan 4 13:55:57 PST 2003
Here is the bit of Ant that I use to compile a translator. I am not expert
but this seems to work. I look at the Parser (or Walker or what ever is
your toplevel translator file) and retranslate all files if I find it is out
of date.
BTW Ant cannot seem to tell if the antlr flags in the build.xml file have
been updated. If I change the ${copyGlobalTrace} setting I have to do
something dramatic (like delete the Parser) to get Ant to retranslate with
this new setting.
<target name="checkTranslatorsUpToDate" >
<uptodate property="TranslatorsBuild.notRequired"
targetfile="${translatorsSrc}/CopyGlobalParser.java">
<srcfiles dir= "${translatorsSrc}" includes="**/*.g"/>
</uptodate>
</target>
<target name="translate" depends="checkTranslatorsUpToDate"
unless="TranslatorsBuild.notRequired">
<!-- run antlr -->
<delete file="${translatorsSrc}/CopyGlobalLexer.java"/>
<delete file="${translatorsSrc}/CopyGlobalParser.java"/>
<delete>
<fileset dir="${translatorsSrc}" includes="*.txt"/>
</delete>
<antlr target="${translatorsSrc}/CopyGlobalLexer.g"
trace="${copyGlobalTrace}">
<classpath>
<pathelement path="${classpath}/antlr.jar"/>
</classpath>
</antlr>
<antlr target="${translatorsSrc}/CopyGlobalParser.g"
trace="${copyGlobalTrace}">
<classpath>
<pathelement path="${classpath}/antlr.jar"/>
</classpath>
</antlr>
</target>
matthew
----- Original Message -----
From: "David Penton" <djplists at arrowsash.com>
To: <antlr-interest at yahoogroups.com>
Sent: Sunday, January 05, 2003 5:24 AM
Subject: [antlr-interest] ant & antlr
> This may properly be a question about ant. I posted (not cross-posted)
> a similar question to the ant mailing list, but I suppose I may be more
> likely to get an answer here than there.
>
> The question is, can anyone tell me how to get ant to recognize
> dependencies on exported/imported token vocabularies? The antlr task in
> ant does not seem to know (and perhaps cannot know) that a parser or
> lexer should be regenerated if its imported token vocabulary changes. Is
> there a good way to set ant up to handle this?
>
> I spent a frustrating hour last night looking for an error in my
> grammars or input files which turned out to stem from the fact that my
> lexer was using an outdated input vocabulary, i.e. my parser had changed
> but ant did not run my lexer grammar through antlr again.
>
> Terence, if you read this, I note your recent comment that you hate
> ant. I am pretty new to ant, but so far I sure as hell don't love it
> either. I'm stuck with it on my project for now, though.
>
> - Dave -
>
>
>
>
>
>
> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
>
>
>
Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
More information about the antlr-interest
mailing list