|How to restart FLEX scanners? email@example.com (1999-02-03)|
|Re: How to restart FLEX scanners? firstname.lastname@example.org (1999-02-12)|
|Re: How to restart FLEX scanners? email@example.com (1999-02-16)|
|Re: How to restart FLEX scanners? firstname.lastname@example.org (1999-02-18)|
|From:||email@example.com (George Neuner)|
|Date:||12 Feb 1999 02:56:05 -0500|
|Organization:||Dynamic ReSolutions, Inc.|
On 3 Feb 1999 23:55:26 -0500, firstname.lastname@example.org (Joe English)
>The language has a "load file" command, which leads to the usual
>re-entrancy problems. I'm solving this in the usual way: the grammar
>is written to return one statement at a time, and the read-eval-print
>loop looks something like this:
> extern PARSE_TREE parse_tree; /* set by yyparse() %start rule */
> int parse_file(FILE *fp)
> YY_BUFFER_STATE old = YY_CURRENT_BUFFER;
> YY_BUFFER_STATE new = yy_create_buffer(fp, ...);
> while (yyparse() != EOF_SIGNAL)
> if (old != NULL)
This won't work for either yyparse or yylex unless the "load file"
command functions as an inline substitution - i.e. the scanner's input
file is changed but the parser simply continues on with the parse
Neither yyparse nor yylex can normally be called recursively. The GNU
project has a Yacc work-alike called Bison which can generate a
reentrant parser compatible with yylex, but as yet there is no
corresponding reentrant scanner tool.
Dynamic Resolutions, Inc.
Return to the
Search the comp.compilers archives again.