tcpdump mailing list archives

Re: [Fwd: Re: Thread Safe Lexer]


From: Eloy Paris <peloy () chapus net>
Date: Wed, 1 Jul 2009 15:32:39 -0400

Behdad,

On Wed, Jul 01, 2009 at 03:04:49PM -0400, Behdad Forghani wrote:

Hello,

Gianluca asked me to forward this to the mailing list. During
Sharkfest09 he had mentioned that Winpcap cannot is not re-entrant
and thread-safe because Lex uses global variables. As you can see,
one solution to this is to use re2c for lexing and lemon for
parsing. The link to re2c is:
http://re2c.org/
http://sourceforge.net/projects/re2c/

Let me know if you want me to help any further.

Both Flex and Bison can generate re-entrant code. The modifications
to the source code to make use of the (non-default) re-entrant
capabilities are small and simple. That would be a faster route to
achieve re-entrancy, as opposed to moving to new lexer/parser.

http://flex.sourceforge.net/manual/Reentrant.html#Reentrant

http://www.gnu.org/software/bison/manual/html_node/Pure-Decl.html#Pure-Decl

Do we use Flex and Bison on all supported platforms, or we have things
setup so we use the original Lex and Yacc on some platforms to have
backward source code compatibility?

Cheers,

Eloy Paris.-

----- Original Message ----- From: "Behdad Forghani"
<behdad.forghani () samsarasol com>
To: <gianluca.varenni () cacetech com>
Sent: Monday, June 29, 2009 12:53 PM
Subject: Thread Safe Lexer


Hi Gianluca,

As you remembered, we discussed thread safe lexer during
Sharkfest. You can use flex++ to generate C++ code that is thread
safe. If you want more information let me know.

Another good tool to make thread safe lexers is re2c.

Using flex++ is probably a no/no, since it generates C++, and
libpcap is strictly C code.
How many changes would be needed to use re2c instead of flex/bison?

Also, I think it would be great to move this discussion to the
tcpdump-workers mailing list, where all the libpcap folks hang out.

Have a nice day
GV


I had wrongly mentioned lemon, lemon generates thread safe parser
and not lexer.

Let me know if you need any help.

Regards,
Behdad


-
This is the tcpdump-workers list.
Visit https://cod.sandelman.ca/ to unsubscribe.
-
This is the tcpdump-workers list.
Visit https://cod.sandelman.ca/ to unsubscribe.


Current thread: