[Top][All Lists]

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

Re: proposal: simplify prologue alternatives into %code

From: Paolo Bonzini
Subject: Re: proposal: simplify prologue alternatives into %code
Date: Tue, 09 Jan 2007 14:36:44 +0100
User-agent: Thunderbird (Macintosh/20061207)

Then a special directive %typed triggering the Bison type system may not be required, as this if %cast appears, one knows the .y file is typed. Another way would that %cast can appear, but is not used, unless a %typed also appears.

%typed is unnecessary if a <foo> tag is used in the grammar. While now <foo> is always a member name, it will be a type name in Java and it would be a type name also in C++ if one wants to expand

%type<some_class>  xyz

to {static,dynamic}_cast<type>(*var).

In fact, something aking to your %typed is already exported to the skeletons as b4_tag_seen_flag, where we have

m4_if(b4_tag_seen_flag, 0,
[[typedef int YYSTYPE;

I'm also against a new directive such as your %cast, since Bison already has too many and -- in this particular case -- a simple %define is all that is needed.

The implementation of %typed would be the same as %union

It would be interesting if you took a look at the implementation of %union (which is just a "code muscle", equivalent to something like "%code stype") before making this imperscrutable statement. :-)


reply via email to

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