Re: Generated Lexers/Parsers and Multi-threading

cdavies@qntm.com
11 Jun 1998 18:52:18 -0400

          From comp.compilers

Related articles
Generated Lexers/Parsers and Multi-threading car@access5.digex.net (1998-06-09)
Re: Generated Lexers/Parsers and Multi-threading tmoog@mcs.net (Tom Moog) (1998-06-11)
Re: Generated Lexers/Parsers and Multi-threading cdavies@qntm.com (1998-06-11)
| List of all articles for this month |

From: cdavies@qntm.com
Newsgroups: comp.compilers
Date: 11 Jun 1998 18:52:18 -0400
Organization: Compilers Central
References: 98-06-038
Keywords: C++, yacc

    car@access5.digex.net (Mr. Blue) wrote:
> Problem:
> 1. need to generate a lexer/parser from some grammar G
> 2. The lexer/parser must be rigged so that they are part of a C++ class
> that is called often with input from a *string*, not stdin.
> 3. Class in (2) must be thread-safe.
>
> [Bison has a reentrant option which would probably do the trick. -John]


I am doing this, with Bison 1.24 and Flex 2.52. It works well.


Bison makes a standalone yyparse() using no statics.
Flex generates a C++ class called yyFlexLexer, that reads from
an istream (or an istrstream).
Some preprocesor defines turn the yyparse() into yyFlexLexer::yyparse(),
and the whole thing is wrapped up nicely.


-- Charlie Davies
--


Post a followup to this message

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