|Thread-safety, lex and yacc. email@example.com (Nicholas Dronen) (2001-03-31)|
|Re: Thread-safety, lex and yacc. firstname.lastname@example.org (2001-04-04)|
|Re: Thread-safety, lex and yacc. email@example.com (Troy Cauble) (2001-04-10)|
|Re: Thread-safety, lex and yacc. firstname.lastname@example.org (Clark) (2001-04-12)|
|From:||Troy Cauble <email@example.com>|
|Date:||10 Apr 2001 01:22:21 -0400|
|Organization:||Bell Labs, Holmdel, NJ, USA|
|Keywords:||lex, yacc, parallel|
|Posted-Date:||10 Apr 2001 01:22:20 EDT|
Nicholas Dronen <firstname.lastname@example.org> wrote:
: Does anyone have experience with making an apparantly non-thread-safe
: lex/yacc code base thread-safe? Suggestions and pointers welcome.
: [If you tell flex to generate a C++ lexer, it's thread safe. Haven't
: seen a thread-safe yacc but I haven't looked very hard either. It
: wouldn't be hard to do. -John]
Flex C lexers are not thread safe, but I recently wrote an awk script
to make one thread safe. (C++ could not be used.)
Redefine all globals in a structure passed in via YY_DECL.
The awk script removes the global definitions, substitutes
arg->global for all globals, and changes the generated
subroutines to take that structure also.
The script also dumped the definition of yy_buffer_state to
a header file so the argument structure could reference it.
A *lot* of the generated subroutines were superfluous for my
intended use, so the awk script just removed those. I also
created an error return for yy_get_next_buffer() and took out
the exit() call.
Return to the
Search the comp.compilers archives again.