Generated Lexers/Parsers and Multi-threading

car@access5.digex.net (Mr. Blue)
9 Jun 1998 12:20:11 -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: car@access5.digex.net (Mr. Blue)
Newsgroups: comp.compilers,comp.compilers.tools.pccts
Date: 9 Jun 1998 12:20:11 -0400
Organization: Express Access Online Communications, Greenbelt, MD USA
Keywords: parse, C++, comment

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.




In looking at the code generated by lex/yacc it would appear the
generated code is NOT thread safe (lots of globals, etc.). This means
an app would have to put a mutex around calls to the parser, which
could kill performance.


Does bison or any other parser generators generate thread-safe code?


Thanks,
Chris
[Bison has a reentrant option which would probably do the trick. -John]
--


Post a followup to this message

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