Re: Re-reentrant parser made with Bison++ and flex++

"R. L. Watkins" <RLWatkins@CompuServe.Com>
22 Dec 2001 22:55:00 -0500

          From comp.compilers

Related articles
Re-reentrant parser made with Bison++ and flex++ letz@grame.fr (2001-12-20)
Re: Re-reentrant parser made with Bison++ and flex++ RLWatkins@CompuServe.Com (R. L. Watkins) (2001-12-22)
| List of all articles for this month |
From: "R. L. Watkins" <RLWatkins@CompuServe.Com>
Newsgroups: comp.compilers
Date: 22 Dec 2001 22:55:00 -0500
Organization: Compilers Central
References: 01-12-098
Keywords: parse
Posted-Date: 22 Dec 2001 22:55:00 EST

Why?


It is much simpler to read the source file through a file handle variable,
and to simply open a new one when encountering an '#include' file, stacking
the original file handle and returning to it when the lexer is finished with
the included source file.


This works well, requires very little memory for any reasonable depth of
inclusion compared to the overhead of instantiating an entirely new lexer
and parser, and conforms precisely to the semantics of '#include'.


R. L. Watkins


> 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.


Post a followup to this message

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