bison-patches
[Top][All Lists]
Advanced

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

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


From: Hans Aberg
Subject: Re: A polymorphic YYSTYPE for C++ (instead of the %union)
Date: Tue, 26 Jun 2007 00:23:06 +0200

On 25 Jun 2007, at 16:57, Akim Demaille wrote:

 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.

I think that the most important thing is to implement the typed default actions, that is, instead of the current untyped $$ = $1, one should have $<type>$ = $<type1>1. That is, the different default actions should be collected according to type, and put into the parser "switch" statement. I think this must be done, regardless which typed method is used, and the difference is essentially then down to how to extract the different types of the YYSTYPE. Michiel De Wilde pointed out another, C++ specific problem, namely that template types may involve the pointed braces "<" and ">". So if one should use a M4 macro to handle these different statically typed YYSTYPEs that may be used with C++ via a M4 macro, some extensions to the handling of type identifiers might be needed. I am not sure of this though: these pointed brackets might still be put into some M4 macro, and then the types used in the grammar might be still be just the usual C/C++ labels.

  Hans Aberg






reply via email to

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