"Joel E. Denny" <[EMAIL PROTECTED]> writes:
> Why was the ability to concatenate several %union's together added?
I'm the guilty party on that. As I recall, the problem was that Bison
formerly had undefined behavior if you had multiple %unions (it
generated garbage code), and I wanted it to do something more
reasonable. I didn't put a lot of thought into it, and I don't think
anybody's really relying on it. We shouldn't let this tail wag any
dog.
Now that I think of it, "%union foo { ... } %union bar { ... }"
probably generates garbage code even now. I guess we should simply
disallow multiple %union, as C does.
Stepping back from this a bit, I'm totally confused now by all the
directives being proposed.
Here's one idea to simplify things a bit. How about if we say that
"%union { ... }" is treated like:
%{
typedef union { ... } YYSTYPE;
%}
That way, whatever solution we use for %{ also works for %union, and
%union is no longer a special case.