[antlr-interest] problem building json grammar maven2 + antlr3

David Holroyd dave at badgers-in-foil.co.uk
Mon Aug 6 16:23:52 PDT 2007


On Sat, Aug 04, 2007 at 10:58:39PM -0400, hanasaki wrote:
> Building json grammar below with the maven2 plugin for antlr3 and netbeans6
> http://www.antlr.org/wiki/pages/viewpageattachments.action?pageId=819220
> http://www.antlr.org/wiki/display/ANTLR3/Using+ANTLR+3+with+Maven+2
> 
> [antrun:run {execution: default}]

I see you're using the antrun recipe, rather than the actual plugin
code.  (A good thing actually, given the second problem below...)

> Executing tasks
>      [java] ANTLR Parser Generator  Version 3.0 (May 17, 2007)  1989-2007
>      [java] error(8):  file JsonTree.g contains grammar JSONTree; names must be identical

The above seems to indicate that the name of the file you've saved from
the wiki differs from the original "JSON" vs "Json".

>      [java] error(3):  cannot find tokens file ./JSON.tokens

Hmm, I didn't allow for that in the Maven plugin yet.  I'll make a
testcase with that grammar and try to get it working.

To get it working using antrun should be a matter of adding a,

  <arg line="-lib ${project.build.directory}/generated-sources/antlr"/>

to the <java> invocation.


>      [java] warning(138): JsonTree.g:0:0: grammar JSONTree: no start rule (no rule can obviously be followed by EOF)

Hopefully, be above is due to one of the earlier errors.


ta,
dave

-- 
http://david.holroyd.me.uk/


More information about the antlr-interest mailing list