help-bison
[Top][All Lists]
Advanced

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

> Re: Fwd: Q: processing multiple mixed data streams using bison


From: Laurence Finston
Subject: > Re: Fwd: Q: processing multiple mixed data streams using bison
Date: Fri, 3 Jun 2005 13:29:48 +0200 (MEST)

> From:         Mohit Jaggi
> Subject:      Fwd: Q: processing multiple mixed data streams using bison
> Date:         Sat, 28 May 2005 23:53:22 -0700

> I am trying to process multiple interleaved streams of data in a
> single process/thread using yacc/bison. Let us say I am running a
> server and have thousands of clients sending me requests at the same
> time.
>
> It seems the parser code uses global variables to keep its state while
> parsing. I guess that one can introduce code to save all the variables
> and restore them...has anyone tried this before?

I don't think this is a reasonable thing to do.  Are the requests
sent by your clients complete statements?  In that case,
there would be no need to save and restore state;
you would just need a way of queueing requests.
On the other hand, a request with a grammatical error could
cause 'yyparse()' to fail, so it would probably be safer to
invoke 'yyparse()' multiple times in separate threads.
Alternatively, you could use a single thread and call to 'yyparse()'
and implement error recovery, but it's difficult to catch every
possible error.
I think it would be easier and safer to just spawn a thread for each
client
and call 'yyparse()' in that thread.
I don't see any reason for using processes, unless your system
doesn't support threads.

Laurence Finston






reply via email to

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