[antlr-interest] C++ file timestamps and makefiles

Stuart Dootson stuart.dootson at gmail.com
Thu Dec 16 10:32:09 PST 2004


On Thu, 16 Dec 2004 11:55:10 -0500, Bryan Ewbank <ewbank at gmail.com> wrote:
> 
> I've noticed some strange behavior, and need confirmation.  It appears
> that ANTRL only creates C++ output files if the output file is
> different than the previously generated file.
> 
> For example, unless I add a new token, the *TokenTypes* files are not
> updated.  If I change the action associated with a rule, only the
> *.cpp file is changed - the *.hpp is unchanged.
> 
> Is this expected of ANTLR, or do I need to be looking elsewhere to
> figure out what is going on?
> 
> Thanks
> - Bryan Ewbank

I've observed that behaviour - I thought I remembered there being a
command-line switch or option to alter the behaviour, but I can't find
it now :-(

What I do is to delete any Antlr outputs before running Antlr,
ensuring they are all generated again. Unless I do this, Visual Studio
& make think that the Antlr outputs are always out of date and need
regenerating. Here's an example from a makefile rule - it uses cantlr,
not the Java Antlr, but it's the same principle.

TestLanguageLexer.cpp, TestLanguageLexer.hpp,
TestLanguageLexerTokenTypes.hpp, TestLanguageParser.cpp,
TestLanguageParser.hpp : TestLanguage.g
    if exist TestLanguageLexer.cpp del TestLanguageLexer.cpp
    if exist TestLanguageLexer.hpp del TestLanguageLexer.hpp
    if exist TestLanguageLexerTokenTypes.hpp del TestLanguageLexerTokenTypes.hpp
    if exist TestLanguageParser.cpp del TestLanguageParser.cpp
    if exist TestLanguageParser.hpp del TestLanguageParser.hpp
    cantlr $(CANTLRFLAGS) TestLanguage.g

Stuart Dootson


 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/antlr-interest/

<*> To unsubscribe from this group, send an email to:
    antlr-interest-unsubscribe at yahoogroups.com

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 





More information about the antlr-interest mailing list