help-bison
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Threadsafe C Based Parser


From: Raji Easwaran
Subject: Re: Threadsafe C Based Parser
Date: Fri, 03 Sep 2004 14:48:40 -0500

Jeannot,

How can I thank you for this plethora of information. This is great. Let me try using this information and your suggestions.

Thanks again.
Raji


From: Jeannot_Langlois <address@hidden>
Reply-To: address@hidden
To: Raji Easwaran <address@hidden>
CC: address@hidden,  address@hidden
Subject: Re: Threadsafe C Based Parser
Date: Fri, 03 Sep 2004 15:02:07 -0400

[CC'ing the Flex and Bison mailing lists, as this should be of common interest to both...]


Hi Raji,

Effectively, it seems that we encountered the same problems with Flex and Bison.


Raji Easwaran wrote:

Jeannot,

We are in the process of making one of our parsers threadsafe. We currently use Bison version 1.75 and Flex version 2.5.4. We are considering using the %pure_parser option on bison to make the parser thread safe and were looking into using %option reentrant option in Flex to make the scanner threadsafe. I was looking at [ http://lists.gnu.org/archive/html/bug-bison/2003-03/msg00031.html] and noticed that you had the same requirements as me.

We want to use a C based parser and scanner. We have been trying to get a version of flex that will support the reentrant option but have not had much luck. Can you point me to where I can get a thread safe scanner? You mentioned that you used version 2.5.27 of the scanner. Do you have a link to where I can download this version?


When I was fiddling to get reentrant-Flex and reentrant-Bison to interact properly in 2003, I found out that newer versions of Flex were being released on SourceForge (I guess I was lucky with either a Google or Freshmeat search...). At the time I wrote the message you quoted, Flex 2.5.27 was the latest version available at sourceforge. Today I see that a newer version of Flex, 2.5.31, seems to have been released. I haven't tried anything with this newer version, tough, but I guess it should fix a few things which *might* help you out.

I found out the newer Flex site to be at:
http://lex.sourceforge.net

Here's the link to the downloads sections of Flex on sourceforge:
http://sourceforge.net/project/showfiles.php?group_id=72099


Also which option did you use to generate the reentrant scanner? Did you use %option reentrant or %option reentrant-bison? Flex 2.5.4 does not seem to recognize either of these options. If you think there are more recent versions of Flex or Bison that we can use, please let me know.

Thanks in advance for your help. Any help regarding this will be much appreciated.
Raji

I believe links I've given you above should help you out a little bit.

Looking through my old files I found out that I was using the following options in my Makefile:

__________________________________________________________________________________________________
flex -R --bison-bridge -s -B -Cemr -L -v -p -i --header-file=myscanner.h -omyscanner.c myscanner.lex
__________________________________________________________________________________________________


I also had the following options set in "myscanner.lex":

_________________________________________________
%option reentrant
%option header-file="myscanner.h"
_________________________________________________


I remember fiddling with "%reentrant" and "%reentrant-bison" options, but can't remember the difference between the two and why I choose one over the other -- I've been doing so much things since that time... eheh :-). Maybe this is related with that "--bison-bridge" option I had used. I guess a bit of reading and documentation will be required here from the reader :-).

I couldn't get completely satisfied with Flex for what I needed to do because it caused me some troubles when interfacing with Bison (reentrency, custom parameter passing, etc...).

Maybe these issues have been resolved now -- I don't know, because after some headaches back then, I decided to write my own reentrant C lexical scanner by hand to interact with Bison (and am now using the newer "%parse-param" and "%lex-param" Bison directives -- which are really nice ways to pass custom parameters to yyparse() and then to yylex() in Bison--, POSIX RegExp libraries, etc...), so I kinda got rid of Flex :-). I use my own lexical scanner with Bison, not Flex and Bison as you as currently trying to do.

But maybe with a little more patience than me and the newer Flex/Bison versions you should be able to get reentrant-Flex and reentrant-Bison to interact properly together.

As a little side-note, even if Bison 1.875 is the latest stable version, I had some discussions with Paul Eggert (from the Bison team), and a feature which I required (%destructor directive) was still unstable in Bison 1.875 and was producing Segmentation faults on compilation, so I installed a newer "beta" Bison version: 1.875c -- it runs fine and seems quite stable *to me*. Just in case you could be using that Bison feature too :-).


So, hopefully these notes should help you out... and maybe a couple of other people too!


"We now return to our regular programming...".

Good luck,


--
Jeannot Langlois
B. Sc.  Computer Science / B. Sc.  Informatique
jeannot12 AT linuxmail DOT org
icq : 1-5-2-6-2-8-9-1
msn : jeannot12 AT hotmail DOT com


------------------------------------------------------------------------------------------------

Looking for a Software Developer in Ottawa, Gatineau, Hull, Sherbrooke or Quebec city (Canada)?
Look no further.
You've just found what you were looking for.

LINUX... SOFTWARE... PROJECTS...

15 rock-solid years in Computer Science.
Always ready for challenges.
Perseverant.
Team spirit.
Autonomous.

One name:  Jeannot Langlois.


------------------------------------------------------------------------------------------------

Vous cherchez un Programmeur-Analyste pour Ottawa, Gatineau, Hull, Sherbrooke ou la ville de Quebec (Canada)?
Ne cherchez plus.
Vous venez de trouver.

LINUX... LOGICIELS... PROJETS...

15 annees solides en Informatique.
Toujours pret pour les defis.
Perseverant.
Esprit d'equipe.
Autonome.

Un seul nom:  Jeannot Langlois.

------------------------------------------------------------------------------------------------

LINUX_LOGO





_________________________________________________________________
Express yourself instantly with MSN Messenger! Download today - it's FREE! http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/





reply via email to

[Prev in Thread] Current Thread [Next in Thread]