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],
            [
],
            [EMAIL PROTECTED])])
--------------------------------

to:
--------------------------------
m4_define([b4_c_knr_formal_decls],
[m4_case([EMAIL PROTECTED],
         [], [],
         [[]], [],
              [m4_map_sep([b4_c_knr_formal_decl],
            [
],
            [EMAIL PROTECTED])])])
--------------------------------

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