help-bison
[Top][All Lists]
Advanced

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

Re: Token types with constructor


From: Hans Aberg
Subject: Re: Token types with constructor
Date: Thu, 26 Aug 2004 19:37:19 +0200

At 14:24 +0200 2004/08/25, Martin Trautmann wrote:
>I am using bison for some time in a C++ Project and I need a Token Type
>that may have a constructor. When I started (4 years) bison had no
>problem with that.
...
>1) Is there any option to change the behaviour of bison to allow YYSTYPE
>to have a constructor?
>2) if not: do you plan to keep it like that in newer versions?
>3) is there a stable version of bison that integrates better in C++
>code?

This is a long story, and a fairly frequently asked one. Bison never
supported C++ officially, even though the parser was written so that one
could compile it under C++. Further, some old C++ compilers did not check
non-trivial constructor in unions. And the C parser stack does not invoke
C++ copy constructors. So the C parser has really never been compatible
with non-trivial C++ constructors, even though one might pass a
compilation, to get a potentially breaking code.

Eventually, there was a decision to let the C parser only support
C-compilation, possibly admitting only C++ POD's. M4 was added to Bison to
facilitate this. A C++ parser was written by some students. But I could not
get it working, so I wrote my own (for Bison 1.75). It is published, with
instructions in the Bison-Patches list.

So I think this is the state of the matter right now.

  Hans Aberg






reply via email to

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