[Top][All Lists]

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

Re: A polymorphic YYSTYPE for C++ (instead of the %union)

From: Akim Demaille
Subject: Re: A polymorphic YYSTYPE for C++ (instead of the %union)
Date: Mon, 25 Jun 2007 16:57:24 +0200
User-agent: Gnus/5.110006 (No Gnus v0.6) Emacs/22.0.95 (gnu/linux)

>>> "MDW" == Michiel De Wilde <address@hidden> writes:

 > Dear Bison maintainers,

 > The attached patch implements a solution to a limitation that bison
 > imposes on C++ developers:

Well, C++ was first :)

 > I have implemented full support for boost::variant AND Bison type
 > selection.

This is great news!  It has been in our todo list for quite a while.

Nevertheless, I believed that using Boost::variants was not the right
approach, as they encode their own tag to know which variant is used
--- an information that the parser already maintains via the state
number.  I was hoping that someday someone would implement a similar
feature, but (i) without the Boost dependency, and (ii) without this
additional space and time cost.

But maybe there are advantages to use boost::variants that I did not
see?  In addition to the fact that the actual implementation burden is
put on them, of course.  This is clearly more elegant for yylex, as
one can write

        yylval = "foo";

        yylval = 12;


instead of something like



and so on.

Yet I'm really curious on the actual cost of handling the tags.  Do
you have any evidence we can disregard them?

reply via email to

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