[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bison 2.1 inserts extraneous semicolon in yyparse definition
From: |
Jim Michaels |
Subject: |
bison 2.1 inserts extraneous semicolon in yyparse definition |
Date: |
Mon, 22 Sep 2008 22:59:07 -0700 (PDT) |
bison 2.1 bug
inserts extraneous semicolon in yyparse definition
using "GNU Software for MS-DOS and Windows" and compatible systems. cd-rom
edition 2, July 2001. environment that came on GNU CD (no updates available,
doesn't come with GCC compiler)
on Windows XP Pro Sp3.
around line 827 of the generated *.tab.c, you get this:
#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 ()
; <-------problem
#endif
#endif
{
int yystate;
int yyn;
int yyresult;
...
}
to a C++ compiler like Borland C++ 5.5, it always chokes on this.
I remove it, and all is fine.
C:\t>bcc32 -O2 -5 -Ic:\borland\bcc55\include -Lc:\borland\bcc55\lib y.tab.c
Borland C++ 5.5.1 for Win32 Copyright (c) 1993, 2000 Borland
y.tab.c:
Warning W8004 y.tab.c 768: 'yymsg' is assigned a value that is never used in fun
ction yydestruct
Error E2040 y.tab.c 830: Declaration terminated incorrectly
*** 1 errors in Compile ***
C:\t>
you can ignore the bogus warning of that kind - it's usually quite wrong.
nearly ANY parser file will cause this.
example:
%{
%}
%token INT
%token SHORT
%%
start : INT SHORT INT SHORT SHORT INT ;
%%
also, in the generated header file, a prototype for yyparse is not created. it
should be. OR, there should at least be an option that generates headers with
prototypes for yyparse, instead of me having to copy it from the c file every
time I generate it.
Jim Michaels
address@hidden
http://JesusnJim.com
- bison 2.1 inserts extraneous semicolon in yyparse definition,
Jim Michaels <=