bison-patches
[Top][All Lists]
Advanced

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

Re: FYI: Missing \n


From: Akim Demaille
Subject: Re: FYI: Missing \n
Date: Tue, 16 Jan 2007 14:09:01 +0100
User-agent: Gnus/5.110006 (No Gnus v0.6) Emacs/22.0.92 (gnu/linux)

>>> "AD" == Akim Demaille <address@hidden> writes:

 > +bison.texinfo:8005: Reducing stack by rule 5:
 > +   $1 = nterm exp (-:1.1: )
 >     $2 = token '+' (-:1.2: )
 >     $3 = nterm exp (-:1.3: )
 >  -> $$ = nterm exp (-:1.1-3: )

This is weird, the semantic values are not reported, although the code
requests it.  I have not investigated in details, but here are a few
facts.

Here is the grammar file without synclines.

Attachment: calc++-parser.yy
Description: Binary data

1. tname is weird!

  "expression" is expected to be an alias of exp:

  %type  <ival> exp        "expression"

  but tname has both:

  const char*
  const calcxx_parser::yytname_[] =
  {
    "\"end of file\"", "error", "$undefined", "\":=\"", "\"identifier\"",
  "\"number\"", "\"expression\"", "'+'", "'-'", "'*'", "'/'", "$accept",
  "unit", "assignments", "assignment", "exp", 0
  };

  I don't remember the details, but I find this very fishy.


2. symbol_value_print_ has the expected call for expressions:

  inline void
  calcxx_parser::yy_symbol_value_print_ (int yytype,
                           const semantic_type* yyvaluep, const location_type* 
yylocationp)
  {
    YYUSE (yylocationp);
    YYUSE (yyvaluep);
    switch (yytype)
      {
        case 4: /* "\"identifier\"" */
        { debug_stream () << *(yyvaluep->sval); };
        break;
      case 5: /* "\"number\"" */
        { debug_stream () << (yyvaluep->ival); };
        break;
      case 6: /* "\"expression\"" */
        { debug_stream () << (yyvaluep->ival); };
        break;
       default:
          break;
      }
  }

  but when observing the reduction of number to expression, the latter
  (the expression) has yytype = 15, not 6.

3. If I remove the aliasing and use exp in the printer, it works.

4. If I leave the aliasing but use exp instead of "expressions", if
   works too.

5. The code is (was) the same for the destructor, so there is good
   chances that the problem is deeper than just bad %printer traces.

I don't have time to do further, sorry :(

reply via email to

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