|Generated Lexers/Parsers and Multi-threading email@example.com (1998-06-09)|
|Re: Generated Lexers/Parsers and Multi-threading firstname.lastname@example.org (Tom Moog) (1998-06-11)|
|Re: Generated Lexers/Parsers and Multi-threading email@example.com (1998-06-11)|
|Date:||11 Jun 1998 18:52:18 -0400|
firstname.lastname@example.org (Mr. Blue) wrote:
> 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
Return to the
Search the comp.compilers archives again.