[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: re-entrant parser scanner "%pure-parser g++
From: |
Anouar LACHHEB |
Subject: |
RE: re-entrant parser scanner "%pure-parser g++ |
Date: |
Thu, 28 Dec 2006 19:11:48 +0100 |
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: address@hidden [
<mailto:address@hidden>
mailto:address@hidden 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
_______________________________________________
address@hidden <http://lists.gnu.org/mailman/listinfo/help-bison>
http://lists.gnu.org/mailman/listinfo/help-bison