Re: Re-reentrant parser made with Bison++ and flex++ (Clint Olsen)
22 Dec 2001 22:57:00 -0500

          From comp.compilers

Related articles
Re-reentrant parser made with Bison++ and flex++ (2001-12-20)
Re: Re-reentrant parser made with Bison++ and flex++ (2001-12-22)
| List of all articles for this month |

From: (Clint Olsen)
Newsgroups: comp.compilers
Date: 22 Dec 2001 22:57:00 -0500
References: 01-12-098
Keywords: yacc, lex
Posted-Date: 22 Dec 2001 22:57:00 EST

In the case of handling include files, you don't really need a
reentrant parser. You just need a reentrant lexer. You recursively
call the lexer on the new input file. By definition, including
another file doesn't require you to reset the state of the parse. The
result should be a syntactically valid stream.

Plain old flex generating C++ should allow you to do this since all
the variables are contained within a parser class. You basically have
to instantiate another lexer and associate it with your new parser.

There are ANSI C solutions to this problem as well. See re2c as an

-Clint (MidiShare) wrote in message news:01-12-098...
> Right now the "include" files semantic action instantiate a new
> lexer/parser to parse the included file, but this does no work
> correctly because of conficts with the running parser.
> The bison documentation speaks of "pure reentrant" parsers that should
> probably be used in this context.
> But with flex++/bison++ which has some differencies with bison, we
> don't know how this "pure reentrant" parsers must be instantiated and
> used, and in particular kow the connection betwwen the lexer and the
> parser has to be done.

Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.