> bison --debug -px -o x.c -dv x_yacc.c
> g++ -c -o x_yacc.o x_yacc.c
>
> I got a compilation error:
>
> x_yacc.c: In function `int x_parse(char*, char*, int)':
> x_yacc.c:1382: error: `x_lex' was not declared in this scope
> make: *** [linux32/x_yacc.o] Error 1


Hi,

You need to declare a matching lex function prototype for the parser
to know how to call it.  Your definition of YY_DECL for the lexer file
should also be available for the yacc file.  What I do is define it in
some common configuration file included by both the lex/parse files,
which keeps them consistent in a convenient way.
e.g.

//--------- begin ----------
// #include me
#define YYLEX_PARAM ...
#define YY_DECL ...

extern YY_DECL;
//---------- end -----------

HTH,

Fang





_______________________________________________
help-bison@gnu.org http://lists.gnu.org/mailman/listinfo/help-bison

Reply via email to