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: Wilson Snyder
Subject: Re: Bison feature requests: types declared with rules
Date: Tue, 24 Feb 2009 15:47:01 -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.

Thanks, I wasn't aware of that syntax that helps a lot.
Would you be willing to add an extra sentence in the manual
under "Nonterminal symbols" saying that %type can be used in
the rule section with the semicolon?  That would have helped
me out.

I'll stick with my preparser as combining the type with the
rule saves me ~500 lines of code, but understand if you want
to leave bison as it is, as with your suggested form most of my
concerns were addressed.

Thanks again.

-Wilson




reply via email to

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