5

Can I use the code generated by flex/bison|lex/yacc in a multithreaded environment ? I'm afraid there are a lot of global variables. How can it be fixed ?

laalto
  • 150,114
  • 66
  • 286
  • 303
Pierre
  • 34,472
  • 31
  • 113
  • 192
  • To you mean to parse various [unrelated] parts of some input over multiple threads? – mjv Nov 04 '09 at 22:44

1 Answers1

10

With flex you can use %option reentrant and with bison %pure-parser to generate re-entrant code that does not have global data. You may still need some sort of synchronization to prevent multiple threads using the same data blocks at the same time.

laalto
  • 150,114
  • 66
  • 286
  • 303