[antlr-interest] file names and grammar names

Terence Parr parrt at cs.usfca.edu
Fri May 19 15:33:16 PDT 2006


On May 19, 2006, at 1:24 PM, Don Caton wrote:
> Perhaps using cpp files wasn't a good analogy.  What I was trying  
> to say is
> that if you have a grammar in fooParser.g then (IMO) it is  
> reasonable to
> emit fooParser.hpp and fooParser.cpp as defaults (or .cs, .py or  
> whatever is
> appropriate for the target language).  That makes things much  
> simpler as far
> as build systems go, and you can override the output names if you  
> want.

I'm pretty much in agreement with this...build tools and antlr itself  
will find it nices that X.g produces X.java *and* X's vocabulary  
file, X.tokens

>>> And even if foo.g hasn't changed, the timestamps of the
>> output files
>>> should be guaranteed to be later than foo.g.
>>
>> You mean due to a previous build right?. Not suggesting the
>> outputfiles be touched always?
>
> Yes.  If you run antlr against any given input, every output file  
> should be
> touched (assuming no errors occur).  I'm not sure why Antlr tries  
> to be
> clever about not updating output files that don't need to change,  
> but it
> ends up requiring workarounds to prevent unnecessary rebuilding in any
> system that uses timestamps to figure out what's out of date.

Yeah, I don't like the "don't touch files that haven't changed"  
bit...I left it in, in deference to Ric's preference or some other C+ 
+ person I think.

I've pretty much made up my mind to enforce grammar name and filename  
correspondence.  Thanks for the great discussion!

Ter


More information about the antlr-interest mailing list