help-bison
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: re-entrant parser scanner "%pure-parser g++


From: David Fang
Subject: Re: re-entrant parser scanner "%pure-parser g++
Date: Thu, 28 Dec 2006 13:01:24 -0500 (EST)

> 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







reply via email to

[Prev in Thread] Current Thread [Next in Thread]