|[3 earlier articles]|
|Re: why use flex? firstname.lastname@example.org (1999-02-01)|
|Re: why use flex? email@example.com (1999-02-03)|
|Re: why use flex? Marko.Makela@HUT.FI (Marko =?ISO-8859-1?Q?M=E4kel=E4?=) (1999-02-03)|
|Re: why use flex? firstname.lastname@example.org (1999-02-05)|
|Re: why use flex? Theodore.Papadopoulo@sophia.inria.fr (Theodore.Papadopoulo) (1999-02-05)|
|Re: why use flex? Marko.Makela@HUT.FI (Marko =?ISO-8859-1?Q?M=E4kel=E4?=) (1999-02-10)|
|Re: why use flex? email@example.com (1999-02-15)|
|Re: why use flex? firstname.lastname@example.org (Dmitri Katchalov) (1999-02-16)|
|From:||email@example.com (Wayne Venables)|
|Date:||15 Feb 1999 23:03:36 -0500|
|Organization:||Sprint Canada Inc.|
|References:||99-01-111 99-02-004 99-02-015 99-02-022|
>> [ re C++ in bison ]
>> Pardon me, but what kind of C++ support would you like to expect from
>> Flex and Bison? I have used Flex 2.5.4 and Bison 1.25 in two compiler
>> projects, both of which are written in C++. I use the tools in the
>> traditional C mode; only the semantic actions contain C++ code.
>C++ forbids putting objects into unions. This makes the yylval
>techniques of passing tokens values rather inadequate for C++.
>Another thing that would be nice is using exceptions for error
>recovery (with the hope of nice cleaning of the created objects).
Actually you can put C++ objects into Unions as long as they don't
have copy-constructors or some nonsense like that. My solution was to
create a class called SemanticValue which could contain objects of
different types (a class that acts like a Union). A bit messy, but on
the plus side, I used assignment operator overloading for simple types
like boolean, string, etc which makes the lexer code look real nice.
Return to the
Search the comp.compilers archives again.