Home > Archive > Compilers > August 2004 > multi threaded bison: yyerror
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
multi threaded bison: yyerror
|
|
| Tamas Sarlos 2004-07-28, 9:08 pm |
| Hi,
I'd like to upgrade my flex/bison generated parser to a multi threaded
(pthreads) parser. I know that I have to create a reentrant flex
wrapper and use %pure_parser in bison.
I need to stop parsing (and do some other things) whenever a syntax
error occurs. However yyerror(...) does not have any parameter which
would help to find out in which thread the syntax error occured. I
could use pthread_self() and associate the necessary data with the
thread id, but this solution seems somewhat awkward. Is there a better
way to do it?
Thanks in advance,
Tamas Sarlos,
Budapest, Hungary
| |
| John Millaway 2004-08-05, 3:59 pm |
| > error occurs. However yyerror(...) does not have any parameter which
> would help to find out in which thread the syntax error occured.
Hi Tamas,
#define yyerror(s) yyerror_r(s, thread_specific_info)
-John M
| |
| Laurence Finston 2004-08-05, 3:59 pm |
| On Wed, 28 Jul 2004, Tamas Sarlos wrote:
>
> I'd like to upgrade my flex/bison generated parser to a multi threaded
> (pthreads) parser.
....
> Is there a better
> way to do it?
I suggest using thread-specific data (pthread_key_create(),
pthread_setspecific() and pthread_getspecific()).
In my parser, the object passed to `yyparse()' via a `void*' contains
a pointer to the object containing the thread-specific data, so I don't actually
need to call `pthread_getspecific()' very often.
If you want to look at my code, it's available under
http://savannah.gnu.org/cgi-bin/vie...df/3dldf/Group/
Laurence Finston
GNU 3DLDF maintainer
http://www.gnu.org/software/3dldf
|
|
|
|
|