bison-patches
[Top][All Lists]
Advanced

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

Re: <reductions>


From: Wojciech Polak
Subject: Re: <reductions>
Date: Fri, 19 Oct 2007 20:52:52 +0200

On 2007-10-17 at 22:21 -0400, Joel E. Denny wrote:

> > > In fact, I might even suggest that
> > > the grammar section itself annotates rules unused rules instead
> > > of using another separate sections.
> > > Similarly, IMHO, there should be only one section about terminals
> > > including both their description (name, number, "string" etc.),
> > > whether they are unused, useless etc.  I don't see the point of
> > > separating them at the XML level.
> > > 
> > > That would solve your "reduction" section naming problem, as
> > > there would be no such section :)

Currently, the <grammar> element keeps all "in use" and other sections
keep the rest (useless, unused, never-reduced). It's both easily human
and machine-readable. It works fine, so now it's a good time to make it
even better, and I like all your suggestions.

> > 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?)
 grammar/rules/useless/rule
 grammar/rules/never-reduced/rule

 grammar/terminals/in-use/terminal
 grammar/terminals/unused/terminal

 grammar/nonterminals/in-use/nonterminal
 grammar/nonterminals/useless/nonterminal


I think the above scheme is the one I like and prefer
the most if you insist in moving all to <grammar>.


> Or should "useless", "never-reduced", and "unused" be attributes instead?

Only if those are always mutually exclusive values,
but they aren't. For instance, a rule can be both
"in use" and "never-reduced". But despite this,
here is a sample with attributes:

 grammar/rules/address@hidden'in-use']
 grammar/rules/address@hidden'useless']
 grammar/rules/address@hidden'never-reduced']
 grammar/terminals/address@hidden'in-use']
 grammar/terminals/address@hidden'unused']
 grammar/nonterminals/address@hidden'in-use']
 grammar/nonterminals/address@hidden'useless']

>   <grammar>
>     ...
>     <nonterminals>
>       <nonterminal number="9" name="$accept" />
>       <nonterminal number="10" name="exp" />
>       <useless>
>         <nonterminal name="x" />
>         <nonterminal name="y" />
>       </useless>
>     </nonterminals>
>   </grammar>

or the way I suggested:

<grammar>
  ...
  <nonterminals>
     <in-use>     
       <nonterminal number="9" name="$accept"/>
       <nonterminal number="10" name="exp"/>
     </in-use>
     <useless>
       <nonterminal name="x"/>
       <nonterminal name="y"/>
     </useless>
  </nonterminals>
</grammar>

Regards,
Wojciech






reply via email to

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