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: Paul Eggert
Subject: Re: [off-topic] flex/bison compatibility issues using C++
Date: Fri, 04 Jun 2004 00:12:22 -0700
User-agent: Gnus/5.1006 (Gnus v5.10.6) Emacs/21.3 (gnu/linux)

"Josh Shinavier" <address@hidden> writes:

> I got our network admin to install 1.875 but am encountering the
> same errors (yylex and yyerror undeclared in [filename].tab.c).

That's a general problem with the Yacc interface; it's not limited to
Bison.  The original Yacc interface was designed when one could call
functions like yylex and yyerror without declaring them.  With C++ you
need to declare them.  So you need to (say) put declarations in a
header file somewhere, and include that header.


> gcc doesn't complain about yylex or yyerror but reports a parse
> error before the "goto yyerrlab2;" statement in [filename].tab.c:

That's a known incompatibility with GCC and Bison.  (Opinions differ
as to whether it's GCC bug or a Bison bug.  :-) Here's a patch for
Bison 1.875:

http://lists.gnu.org/archive/html/bug-bison/2003-01/msg00031.html

and it'll be fixed (in a different way) in the next official release.




reply via email to

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