Back
I am in the middle or reading Domain Specific Languages by Martin Fowler and I have started to experiment with ANTLR today. After copy&pasting of example and fixing a few problems I wanted to generate a parser from grammar. I wanted to use following Ant snippet taken from Ant documentation (Rough Cuts of the book does not show how to do that):
<target name="generate" depends="prepare">
<antlr target="${dir.antlr.src}/Greetings.g" outputdirectory="${dir.gen}" />
</target>
But regardless of my experiments ANTLR process invoked from Ant always ended with Unable to determine generated class. Googling did not help. I found many questions, but no solution. Finally I settled on a following workaround, based on standalone generation of sources from the grammar:
<target name="generate" depends="prepare">
<java jar="lib/antlr-3.2.jar" fork="true">
<arg value="-o"/>
<arg value="${dir.gen}"/>
<arg value="${dir.antlr.src}/Greetings.g"/>
</java>
</target>
This does the trick. Now back to the example to see what it does.
Back