bug-bison
[Top][All Lists]
Advanced

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

Re: Bison feature requests: types declared with rules


From: Joel E. Denny
Subject: Re: Bison feature requests: types declared with rules
Date: Fri, 20 Feb 2009 20:31:14 -0500 (EST)

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

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