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: Sun, 30 Sep 2007 02:53:56 -0400 (EDT)

Hi Akim,

On Sun, 30 Sep 2007, Akim Demaille wrote:

> Le 30 sept. 07 ? 01:11, Joel E. Denny a ?crit :
> 
> > The XML output has two different elements named "reductions".  One reports
> > reduce actions in the sense of productions performed by a bottom-up
> 
> I guess you meant actions, or is this a meaning of
> production I don't know?

I mean a reduce action reduces the stack by some grammar production.  
Nothing new.  Just bad wording on my part.

> > parser.  The other reports useless/unused symbols and rules that are found
> > by the grammar reductions of reduce.c.
> > 
> > Perhaps we can choose a better name for the latter case.
> > "grammar_reductions", "redundancies", any other suggestions?
> 
> Maye "simplifications" is too general, but it may fit.

I'm not really sure unused terminals fall into any of these categories.  
Does their identification reduce or simplify the grammar or parser in any 
way?  They might be redundant or they might be used by the lexer to induce 
a syntax error.

> > Or perhaps
> > the "useless" and "unused" elements don't need to be grouped together
> > inside a parent element.  There's only one of each anyway.  Here's an
> > example from Wojciech's web page:
> > 
> >   <reductions>
> >     <useless>
> >       <nonterminals>
> >         <nonterminal>useless</nonterminal>
> >       </nonterminals>
> >       <rules>
> 
> I'm a bit surprised by the order that was chosen: it seems
> more logical (to me) to start with the various categories
> (nterm, rule, term) and inside each group to report useless,
> unused etc.  WDYT?

Do you mean you would group useless and useful rules together, for 
example?

> >         <rule number="6">
> >           <lhs>useless</lhs>
> >           <rhs>
> >             <symbol class="terminal">STR</symbol>
> >           </rhs>
> >         </rule>
> 
> Should we really repeat the rules then?  Its number suffice:
> the grammar is defined elsewhere.

Useless rules are eliminated from the grammar, so this is not a 
repetition.

> BTW, maybe the grammar should
> be defined first, and then the rest of the information.  The
> order should be chosen to please tools, not humans.

Would that change help tools significantly?  If not, I figure we might as 
well please the humans.

reply via email to

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