bug-bison
[Top][All Lists]
Advanced

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

Re: Bison Bug - Compiling Xfree86


From: Akim Demaille
Subject: Re: Bison Bug - Compiling Xfree86
Date: 11 Oct 2002 09:21:45 +0200
User-agent: Gnus/5.0808 (Gnus v5.8.8) XEmacs/21.4 (Honest Recruiter)

| Here is more detail on the gram.y and a new xkbparse.y issue. But under
| Bison 1.35, I get no other errors. But with Bison 1.50, I get the following
| errors. I have enclosed the files for you to view and give feedback one.
| Thank you in advance for your help. I have fixed the ; errors, but these are
| show stoppers.

Please, keep this on bug-bison so that it is archived.

First grammar ``gram.y''.  Bison says:

/tmp % bison gram.y                                               nostromo 9:14
gram.y:451.3-461.18: conflit de type («  » « num ») pour l'action par défaut

and if you look at these lines:

   442  color_entry     : CLKEYWORD string      { if (!do_colorlist_keyword 
($1, color,
   443                                                                       
$2)) {
   444                                              twmrc_error_prefix();
   445                                              fprintf (stderr,
   446                          "unhandled list color keyword %d (string 
\"%s\")\n",
   447                                                       $1, $2);
   448                                              ParseError = 1;
   449                                            }
   450                                          }
   451                  | CLKEYWORD string      { list = 
do_colorlist_keyword($1,color,
   452                                                                        
$2);
   453                                            if (!list) {
   454                                              twmrc_error_prefix();
   455                                              fprintf (stderr,
   456                          "unhandled color list keyword %d (string 
\"%s\")\n",
   457                                                       $1, $2);
   458                                              ParseError = 1;
   459                                            }
   460                                          }
   461                    win_color_list
   462                  | CKEYWORD string       { if (!do_color_keyword ($1, 
color,
   463                                                                   $2)) {
   464                                              twmrc_error_prefix();
   465                                              fprintf (stderr,
   466                          "unhandled color keyword %d (string \"%s\")\n",
   467                                                       $1, $2);
   468                                              ParseError = 1;
   469                                            }
   470                                          }
   471                  ;

you see that the rule

color_entry     : CLKEYWORD string      { list = do_colorlist_keyword($1,color,
                                                              $2);
                                  if (!list) {
                                    twmrc_error_prefix();
                                    fprintf (stderr,
                "unhandled color list keyword %d (string \"%s\")\n",
                                             $1, $2);
                                    ParseError = 1;
                                  }
                                }
          win_color_list

ends with a ``win_color_list'', and therefore, since there is no
action, Bison will do $$ = $1, which makes a type clash since
according to the grammar, color_entry has no type, and win_color_list
has type num.

So add a {} to say `no action':

   442  color_entry     : CLKEYWORD string      { if (!do_colorlist_keyword 
($1, color,
   443                                                                       
$2)) {
   444                                              twmrc_error_prefix();
   445                                              fprintf (stderr,
   446                          "unhandled list color keyword %d (string 
\"%s\")\n",
   447                                                       $1, $2);
   448                                              ParseError = 1;
   449                                            }
   450                                          }
   451                  | CLKEYWORD string      { list = 
do_colorlist_keyword($1,color,
   452                                                                        
$2);
   453                                            if (!list) {
   454                                              twmrc_error_prefix();
   455                                              fprintf (stderr,
   456                          "unhandled color list keyword %d (string 
\"%s\")\n",
   457                                                       $1, $2);
   458                                              ParseError = 1;
   459                                            }
   460                                          }
   461                    win_color_list
                                                { /* No action. */; }

   462                  | CKEYWORD string       { if (!do_color_keyword ($1, 
color,
   463                                                                   $2)) {
   464                                              twmrc_error_prefix();
   465                                              fprintf (stderr,
   466                          "unhandled color keyword %d (string \"%s\")\n",
   467                                                       $1, $2);
   468                                              ParseError = 1;
   469                                            }
   470                                          }
   471                  ;



Then your second grammar: xkbparse.y:


/tmp % LC_ALL=C bison xkbparse.y                                  nostromo 9:16
xkbparse.y:452.3: parse error, unexpected "|"
xkbparse.y:515.3: parse error, unexpected "|"

Bison says to read the lines 452 and 515.  At these lines you see
there are spurious semicolons:

   449  ShapeDecl       :       SHAPE String OBRACE OutlineList CBRACE SEMI
   450                          { $$= ShapeDeclCreate($2,(OutlineDef 
*)&$4->common); }
   451                  ;
                    ^^^^^^^^^

   452                  |       SHAPE String OBRACE CoordList CBRACE SEMI
   453                          { 
   454                              OutlineDef *outlines;


and here too:

   510  OverlayKeyList  :       OverlayKeyList COMMA OverlayKey
   511                          { 
   512                              $$= (OverlayKeyDef *)
   513                                  AppendStmt(&$1->common,&$3->common);
   514                          };
                             ^^^^^^^^^
   515                  |       OverlayKey


Hope this helps!




reply via email to

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