Related articles |
---|
[3 earlier articles] |
Re: why use flex? tnaran@direct.ca (1999-02-01) |
Re: why use flex? colas@aye.inria.fr (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? tnaran@direct.ca (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? wvenable_net@iname.com (1999-02-15) |
Re: why use flex? dmitrik@my-dejanews.com (Dmitri Katchalov) (1999-02-16) |
From: | wvenable_net@iname.com (Wayne Venables) |
Newsgroups: | comp.compilers |
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 |
Keywords: | C++ |
>> [ 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.
Later,
Return to the
comp.compilers page.
Search the
comp.compilers archives again.