[antlr-interest] Antlr ANT task: Seemless builds using the Antlr -Problems and solutions. Help appreciated!

Scott Stanchfield scott at javadude.com
Sun Apr 17 11:02:42 PDT 2005


> (*) Looking forward for the update. Was afraid the plugin 
> project was lost. I hope it will suport eclipse 3.1M6+

It supports 3.1M5, 3.1M6 and 3.0.x right now. The 3.1 support is better
though, as it takes care of classpath setup automatically ;)

> > *However*, order of .g compilation can matter, as one grammar can 
> > output token types that another grammar needs, or there could be 
> > grammar inheritance.
> 
> Point taken. Maybe this would only be recommended in case 
> compilation order does NOT matter. (Unless antlr is changed 
> to process the *.g files in multiple passes which is probably 
> too much implementation work compared to the benefit).

I think most folks only have a few antlr files and probably not with cross
dependencies, so it could be done. Don't know that I'll have time for it,
though.


> > I'd also like to set up some way to make "clean"
> > easy, so we'll know which
> > files were generated by antlr. I'm doing this in the 
> eclipse plugin (I 
> > added "clean" support), but to do it for an ant build would require 
> > tracking generated files in another file, like .antlr-generated or 
> > something. We can then have a <antlr clean="yes"> option 
> that removes 
> > any generated files. (We would have to always append to the 
> > .antlr-generated file to capture all renames and such until a clean)
> 
> Not sure that I understand this. Can't the files that was 
> generated be derived by looking at the *.g files and the 
> arguments to the ANT task (assuming these do not change)? I 
> generate java files to a special build\generatedsrc 
> directory. I have no problem cleaning that. As a matter of 
> fact I am not sure I like to have additional files generated 
> to keep track of things if it can be avoided.

two problems
* the name of the grammar could change (I tend to do this a few times when I
first start a project)
  we would lose the names of the old generated files
* the generated files depend on the code generator and output options - we'd
have to rerun antlr to determine these

For eclipse, the plugin adds some persistent properties to the generated
files, and we use these to determine what to kill.

> Hope the comments are useful for you.

Definitely!

Later,
-- Scott







More information about the antlr-interest mailing list