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, 27 Oct 2007 15:52:35 -0400 (EDT)

On Tue, 23 Oct 2007, Akim Demaille wrote:

> > By the way, I think the distinction between "useless" and "never reduced"
> > is unclear both in the XML and in Bison's existing .output files.  That
> > is, useless rules are never reduced, and rules that are never reduced are,
> > in some sense, useless.
> > 
> > When Bison says "useless", it really means (1) "grammatically useless",
> > (2) "useless before conflicts", or (3) "useless in grammar".  That is, the
> > nonterminal or rule is useless before the parsing technique (LALR(1) in
> > Bison's case) is even considered.
> > 
> > By "never reduced", Bison means (1) "useless due to conflicts", (2)
> > "useless after conflicts", or (3) "useless in parser".  That is, the rule
> > is useless after the parsing technique is considered.
> > 
> > #1 seems clear in both cases, but it's verbose.  The words "before" and
> > "after" in #2 sound a little like they have something to do with conflicts
> > in predecessor and successor states, and that's not what we mean.  I
> > prefer #3, which I think will also look nice in XML.
> > 
> > What do people think?
> 
> Agreed, it looks like the clearest.

Thanks.

Can someone explain what was intended by the following code in reduce.c?

  static void
  reduce_print (void)
  {
    if (yacc_flag && nuseless_productions)
      fprintf (stderr, ngettext ("%d rule never reduced\n",
                                 "%d rules never reduced\n",
                                 nuseless_productions),
               nuseless_productions);

That is, why does -y cause Bison to report the count of grammatically 
useless rules as "rules never reduced"?  Later in this function, Bison 
reports the count again but as "useless rules".  Surely this is wrong, but 
I'm not sure what was intended.




reply via email to

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