help-flex
[Top][All Lists]
Advanced

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

RE: Reentrant flex & bison


From: Bruce Lilly
Subject: RE: Reentrant flex & bison
Date: Fri, 3 Dec 2004 07:31:18 -0500
User-agent: KMail/1.7.1

On Thu December 2 2004 07:05, Krishna Murthy Gudipati wrote:
> Hi Bruce,
> 
> I have upgraded my bison 1.875 and compiled my lexer and parser with %option
> reentrant %option bison-bridge %pure_parser. And i made appropriate changes
> in my .c code to pass the input file name using yyset_in().
> 
> My Code
> -------
> yyscan_t yyscanner;

Make sure that that's defined with sufficient scoping to prevent it being
overwritten with garbage (e.g. make sure it's not an auto variable that's
part of the stack for a function that's not active for the duration of
lexical analysis -- you might want to move it into "some_function" to
make sure).

> extern int yyparse(yyscan_t yyscanner);
> extern yylex_init(yyscan_t *yyscanner );
> extern void yyset_in(FILE * in_str ,yyscan_t yyscanner );
> FILE *inf;
> 
> .
> .
> 
> some_function(){
> .
> .
> yylex_init(&yyscanner);
> yyset_in(inf, yyscanner);

You may need yyrestart(inf, yyscanner); here

> yyparse(yyscanner);

You'll need yylex_destroy(yyscanner); when you're finished.

> 
> .
> .
> }
> 
> The code is compiled but at run time it is giving the "fatal flex scanner
> internal error--end of buffer missed". Thru the GDB i am not able to enter
> into the function yyparse(yyscanner);
> 
> Please suggest.

If the items above don't help, run flex with the -d option to
enable debugging, then have your code call yyset_debug before
yyparse.  You might also want to enable warnings when compiling
and linking, and look carefully at the warning messages -- there
are some incompatibilities between different beta releases of flex
and different beta releases of bison (the latest of which is 1.875d).




reply via email to

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