[antlr-interest] Bug report: 2.7.5 and 2.7.6

Harmon Nine hnine at isis.vanderbilt.edu
Wed Oct 11 07:57:56 PDT 2006


Thanks much for the info.  I was using the "An Introduction to ANTLR"
section.

One thing:  is there a means of automatically determining, perhaps
through a precompiler macro, what version of antlr is being used during
a compile?

I'd like to use the latest version of antlr in a software port (to
linux), but the original software uses antlr-2.7.1, and that is pretty
much cast in stone.  Is there a way of doing something like the
following?

#include "CExprLexer.hpp"
#include "CExprParser.hpp"
#include <sstream>

int main( void ) {

  std::istringstream cexprStream( "entryMode <= -2" );

  CExprLexer cExprLexer( cexprStream );
  CExprParser cExprParser( cExprLexer );

///////////////////////////////////////
#if ANTLR_VERSION != 2.7.1
  antlr::ASTFactory astFactory;
  CExprParser.initializeASTFactory( astFactory );
  CExprParser.setASTFactory( &astFactory );
#endif
///////////////////////////////////////

  cExprParser.expr();

  antlr::RefAST refAST( cExprParser.getAST() );
  std::cerr << "tree = " << refAST->toStringTree() << std::endl;

return 0;
}

Thanks.

-- Harmon

> -----Original Message-----
> From: Ric Klaren [mailto:ric.klaren at gmail.com]
> Sent: Wednesday, October 11, 2006 6:12 AM
> To: Harmon Nine
> Cc: antlr-interest at antlr.org
> Subject: Re: [antlr-interest] Bug report: 2.7.5 and 2.7.6
> 
> Hi,
> 
> On 10/11/06, Harmon Nine <hnine at isis.vanderbilt.edu> wrote:
> > The bug results in a segmentation fault.  Just run:
> 
> I checked the zip, it's indeed as Loring suspected: no ASTFactory
> initialization. Check the docs/examples on how to do this.
> 
> Cheers,
> 
> Ric



More information about the antlr-interest mailing list