help-bison
[Top][All Lists]
Advanced

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

Re: Problems using bison and flex with C++


From: Laurence Finston
Subject: Re: Problems using bison and flex with C++
Date: Wed, 23 Jun 2004 09:29:19 +0200 (MEST)

On Tue, 22 Jun 2004, Hans Aberg wrote:

> At 09:07 -0300 2004/06/22, Carlos Augusto Lains Leitão wrote:
> >     My name is Carlos and i am experiencing some problems using flex
> >and bison with c++. I have generated the lexical scanner with flex and the
> >the parser with bison. When i compile my program with gcc there is no
> >problem and everything goes well but when i use g++ to compile the
> >compiler points some errors such like: "undefined reference to yylex in
> >the parser.tab.c generated by bison, undefined reference to yyparse in
> >lex.yy.c generated by flex, undefined reference to yyerror in parser.tab.c
> >generated by bison". Colud anyone give me an advice.
>
> The Bison C parser will not work under C++ for several reasons, for
> example, its stack does not invoke copy constructors when re-allocating. As
> I could not get the Bison C++ parser working directly, I wrote my own. The
> details are posted in the Bison-Patches group. Some fellows said that they
> were able to follow the instructions to get a working C++ parser on their
> own. I think this is the state of the matter, until somebody writes a
> (working) C++ parser that comes with the Bison distribution.
>
>   Hans Aberg
>

I don't understand this. I'm using Bison with C++ and I haven't had any
problems. With very few exceptions valid C code should also be valid
C++ code.  Am I missing something here?

Laurence




reply via email to

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