bug-bison
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [off-topic] flex/bison compatibility issues using C++


From: Josh Shinavier
Subject: Re: [off-topic] flex/bison compatibility issues using C++
Date: Thu, 03 Jun 2004 23:33:02 +0000

That helps, thanks (we were using Bison 3.5). I got our network admin to install 1.875 but am encountering the same errors (yylex and yyerror undeclared in [filename].tab.c). If I add the following to my Bison header, gcc doesn't complain about yylex or yyerror but reports a parse error before the "goto yyerrlab2;" statement in [filename].tab.c:

typedef struct yy_buffer_state *YY_BUFFER_STATE;

extern "C" {
 YY_BUFFER_STATE yy_scan_string( const char * );
 void            yy_delete_buffer( YY_BUFFER_STATE );
       int yyerror(const char *);
       int yyparse(void);
       int yylex(void);
       int yywrap()
       {
               return 1;
       }
}

Now at least I know it's definitely something about my input files which is causing failure...

Josh Shinavier



Recent versions of bison no longer have a bison.simple; they have a
yacc.c.  If you don't want to worry about growing the stack when it
overflows, and if your %union contains objects that don't need
destructors, then it should just work "out of the box".  You can try
it yourself wwith the latest test version:

ftp://alpha.gnu.org/gnu/bison/bison-1.875d.tar.gz

There is also a C++ skeleton called lalr1.cc that is also supposed to
work, though it hasn't been tested as much.

> I need my instructor to be able to compile the parser on his
> machine.

I'm afraid that there's no single set of instructions that will work
with C++ for all versions of Bison and/or Yacc.

_________________________________________________________________
Looking to buy a house? Get informed with the Home Buying Guide from MSN House & Home. http://coldwellbanker.msn.com/





reply via email to

[Prev in Thread] Current Thread [Next in Thread]