bison-patches
[Top][All Lists]
Advanced

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

Re: <reductions>


From: Joel E. Denny
Subject: Re: <reductions>
Date: Sat, 10 Nov 2007 00:30:30 -0500 (EST)

On Fri, 19 Oct 2007, Joel E. Denny wrote:

> On Fri, 19 Oct 2007, Wojciech Polak wrote:
> 
> > > > What about something like the following?  Under grammar, we could have 
> > > > rules/useless, rules/never-used, nonterminals/useless, and 
> > > That should be "never-reduced" instead of "never-used".
> > > > terminals/unused.
> > 
> > We would also need a name for "in use" elements
> > (to make it consistent):
> > 
> >  grammar/rules/in-use/rule   (or "used", or other name?)
> 
> Or "useful"?  I like that it's the opposite of "useless".

> Consider this grammar, which is a
> slightly modified version of your errors.y example:
> 
>   %expect 1
>   %%
>   exp: e 'e'; 
>   e: /* Nothing. */ | 'e';

Add this grammatically useless rule:

    a: ;

> Or should we list rules out of order so we don't need multiple "useful" 
> and "never-reduced" elements?  Maybe attributes would be cleaner?

> How about @usefulness?

So, I'm thinking we should have this:

  <rule number="0" usefulness="useful">...</rule>
  <rule number="1" usefulness="useful">...</rule>
  <rule number="2" usefulness="useless-in-parser">...</rule>
  <rule number="3" usefulness="useful">...</rule>
  <rule number="4" usefulness="useless-in-grammar">...</rule>

Similarly for nonterminals:

  <nonterminal symbol-number="6" name="e" usefulness="useful"/>
  <nonterminal symbol-number="7" name="a" usefulness="useless-in-grammar"/>

Same for terminals but they would have values "useful" and 
"unused-in-grammar" since it's not possible for Bison to know that a 
terminal is truly "useless".

Any objections?  If not, I can work on the implementation.




reply via email to

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