bug-bison
[Top][All Lists]
Advanced

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

Bison feature requests: types declared with rules


From: Wilson Snyder
Subject: Bison feature requests: types declared with rules
Date: Fri, 20 Feb 2009 19:55:07 -0500 (EST)

First, thanks for the recent improvements; the .dot files
and more detailed reports are especially useful.

I have a feature request.  Rather than writing

   %type <t>  rule1

   ...
   
   rule1:  ... ;

I'd like bison to accept

   rule1<t>:  ... ;

That is the grammar describing the rule can also declare the
type that rule produces.  This is equivelent to putting the
%type earlier in the program.  (You can mix either forms and
you'd also still need to use %left and %right etc as
before.)

I wrote a quick Perl wrapper that did this and have been
using it on my 3000 rule bison files with great success for
several months now, so am pretty sure it would help others
out if it was an addition to bison itself.

The point of this is that you can then more easily
cut-and-paste and comment out rules, as everything needed
for that rule is in one spot (before this change I was
always forgetting to declare the proper type when making new
rules.)  It's also better when writing the productions as
you can see what type the productions should produce.

Thanks for considering this.




reply via email to

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