bison-patches
[Top][All Lists]
Advanced

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

Re: prologue alternatives


From: Paul Eggert
Subject: Re: prologue alternatives
Date: Sun, 17 Sep 2006 10:12:28 -0700
User-agent: Gnus/5.1008 (Gnus v5.10.8) Emacs/21.4 (gnu/linux)

"Joel E. Denny" <address@hidden> writes:

> Are you suggesting YYSTYPE shouldn't be a single union?  

Yes, if that's a better way to handle multiple uses of %union.

> I see the Bison grammar file language as something of a meta language that 
> can do better than C... and %type-code{...} seems to make that possible.

I guess that's where we disagree.  I think Bison's grammar language is
inherently linked to the underlying implementation language (C or Java
or whatnot), and that people can't make sensible use of one without
understanding the other.

It's possible to design things differently, but that would be a major
redesign, and arguably it wouldn't be Yacc-like (or Bison-like :-) any
more.

> If I suddenly realized that I needed to add a header that contained 
> YYSTYPE,

This is not a normal small change that one would make to a grammar.
It's all right if a disruptive change like that causes, well,
disruption.

> if we're going for maximum flexibility in all areas, we could 
> take your proposal and extend your $declare{YYSTYPE} to a general variable 
> language.  Where "stype-code" is a user variable and "YYSTYPE" is a Bison 
> variable:
>
>   %header {
>     $var{stype-code}
>     $var{YYSTYPE}
>   }

Something like that might be reasonable, yes.

Also, it might make sense to let the user specify the name of
the header, or even to generate multiple (different) headers.

More generally, perhaps we should have a sublanguage to let the user
generate arbitrary files containing information of interest.  This
would supersede the need for the (no-longer-working) -n option.

Just thinking out loud....




reply via email to

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