> 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 _______________________________________________ Help-bison@gnu.org http://lists.gnu.org/mailman/listinfo/help-bison