Monday, December 6, 2010

C/flex: reentrant lexical analysis

There is a great deal of confusion on how to use flex/bison (lex/yacc) with reentrancy. The biggest reason, as shown here, is that flex and bison deal with reentrancy differently.

To clear some of that up, I posted an Answer at Stackoverflow. With reentrant flex, I recommend using Lemon Parser, rather than bison.

Note that flex scanners are not "as reentrant" as lex scanners. However, if bison is avoided, then the flex C++ scanner (also reentrant) is probably a good alternative to %option reentrant, maybe with a small speed penalty.

No comments:

Post a Comment