0
votes

i have written a bison, flex and c++ files. Compilation of bisoon and flex was passed. But when i'm trying to compile the c and cpp files:
g++ *.cpp *.c, i get strange error: lex.yy.c:479: error: expected `;' before "static" and when i opened lex.yy.c file, i see code that was automatically created by flex. This is some part of code around line 479, line 479 is bold:

using namespace std;
using namespace output
#line 465 "lex.yy.c"

/* Macros after this point can all be overridden by user definitions in
 * section 1.
 */

#ifndef YY_SKIP_YYWRAP
#ifdef __cplusplus
extern "C" int yywrap YY_PROTO(( void ));
#else
extern int yywrap YY_PROTO(( void ));
#endif
#endif

#ifndef YY_NO_UNPUT

static void yyunput YY_PROTO(( int c, char *buf_ptr )); #endif

#ifndef yytext_ptr
static void yy_flex_strncpy YY_PROTO(( char *, yyconst char *, int ));
#endif

i don't have any idea what to do. Please help me.

thanks

1

1 Answers

0
votes

You should`t try to fix the error in file generated by lex, instead of it you need to check your lex specification for errors.

UPDATE:

Possible place to look for source of such mistake is lex specification user code section. As it is noticed in comments, LEX isn`t checking code that it generates from the specification.