[antlr-interest] Antlr 2.7.5 bug or works as designed?

Paul Johnson gt54-antlr at cyconix.com
Tue Jun 28 03:45:04 PDT 2005


Oscar Simpson wrote:

> Is this a problem with ANTLR, the JRE, or this the intended behavior?

(a) and (c), I suspect ('suspect' because I don't know how your build 
works).

I run cantlr on Linux with a makefile. cantlr is intelligent enough not 
to rebuild any targets which don't change. This can cause problems if 
your makefile dependencies look like this (as they must):

target <- cantlr output (eg. 'x.hpp') <- grammar file

Assume that you change the grammar file, and cantlr runs, but doesn't 
change x.hpp. You regenerate 'target', as required, but now x.hpp is 
*older* than the grammar file. Next time around, make notices this, so 
it reruns cantlr to regenerate x.hpp, even though the grammar hasn't 
changed.

I fix this in my makefiles by manually touching all cantr's (supposed) 
outputs each time cantlr is run. This functionality should probably be 
in cantlr itself.

HTH

Paul



More information about the antlr-interest mailing list