bug-bison
[Top][All Lists]
Advanced

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

Bug


From: Mindaugas
Subject: Bug
Date: Thu, 08 Mar 2007 20:02:18 +0200
User-agent: Mozilla Thunderbird 1.0.7 (Windows/20050923)

Hello,


I've found bug in bison 2.1. I'm using Windows and I can not test this with new version 2.3, because I can't find 2.3 executables for windows. I've use bison for much larger file, but this is reduced sample to indicate a problem.

b.y:
--------------------------------
%%

Crlf       : '\n'          { }
           ;
--------------------------------

Command
   bison -v -d b.y -ob.c
produces b.c file, which fails to compile. The reason of failure is this part of code:
--------------------------------

/*----------.
| yyparse.  |
`----------*/

#ifdef YYPARSE_PARAM
# if defined (__STDC__) || defined (__cplusplus)
int yyparse (void *YYPARSE_PARAM)
# else
int yyparse (YYPARSE_PARAM)
  void *YYPARSE_PARAM;
# endif
#else /* ! YYPARSE_PARAM */
#if defined (__STDC__) || defined (__cplusplus)
int
yyparse (void)
#else
int
yyparse ()
    ;
#endif
#endif
{

--------------------------------


Function declaration is invalid, because of extra ";":
--------------------------------
int
yyparse ()
    ;
{
--------------------------------


I've made a change in file share/bison/c.m4 from:
--------------------------------
m4_define([b4_c_knr_formal_decls],
[m4_map_sep([b4_c_knr_formal_decl],
            [
],
            address@hidden)])
--------------------------------

to:
--------------------------------
m4_define([b4_c_knr_formal_decls],
[m4_case(address@hidden,
         [], [],
         [[]], [],
              [m4_map_sep([b4_c_knr_formal_decl],
            [
],
            address@hidden)])])
--------------------------------

This fixes the problem, but I'm not sure if it is a correct solution.

Is it a bug of bison or the problem is inside my grammar file? Thank You for the answer.


Best regrds,
Mindaugas




reply via email to

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