bison-patches
[Top][All Lists]
Advanced

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

Re: proposal: simplify prologue alternatives into %code


From: Hans Aberg
Subject: Re: proposal: simplify prologue alternatives into %code
Date: Tue, 9 Jan 2007 14:50:49 +0100

On 9 Jan 2007, at 14:36, Paolo Bonzini wrote:

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.

I am aware of that: %typed would be used to ensure all stuff is typed.

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;
# define YYSTYPE_IS_TRIVIAL 1]]

The changes are small. But on should also keep the door for other langauge than C/C++/Java.

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.

Well, it is a fundamental feature of Bison that needs to be expanded. So one adds commands to help the user. If, in principle, all commands could be replaced by %define, woud you want to use it?

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

Sorry, this is not in my dictionary.

statement. :-)

I am not sure what you are meaning: I implemented it years ago in Bison, but I have just forgotten it. I jus do not remember the details.

  Hans Aberg






reply via email to

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