Hi David,

I tried before your solution using a common .h file for .lex and .yacc,
however since I'm using "%pure-parser" in my .yacc, the YYSTYPE used in
"yylex" proto is not visible to the .h itself.

Any help (more verbose please) ?

Here is the yylex proto:

#define YY_DECL int yt_unique_datalog_lex ( YYSTYPE * lvalp, char *
xUnique_File_Name, int xIdentification )

Best regards,
AnL.

-----Original Message-----
From: [EMAIL PROTECTED] [
<mailto:[EMAIL PROTECTED]>
mailto:[EMAIL PROTECTED] On Behalf Of David
Fang
Sent: Thursday, December 28, 2006 7:01 PM
To: Anouar LACHHEB
Cc: Help Bison
Subject: Re: re-entrant parser scanner "%pure-parser g++

> 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





_______________________________________________
[email protected]  <http://lists.gnu.org/mailman/listinfo/help-bison>
http://lists.gnu.org/mailman/listinfo/help-bison

_______________________________________________
[email protected] http://lists.gnu.org/mailman/listinfo/help-bison

Reply via email to