On Fri, 20 Feb 2009, Wilson Snyder wrote:

> I have a feature request.  Rather than writing
> 
>    %type <t>  rule1
> 
>    ...
>    
>    rule1:  ... ;
> 
> I'd like bison to accept
> 
>    rule1<t>:  ... ;

> 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.

Why not just put the %type right before the rule in the grammar section?

  %%
  %type <t> rule1;
  rule1: ... ;

However, notice that a semicolon is required when declarations are moved 
to the grammar section.


Reply via email to