bug-bison
[Top][All Lists]
Advanced

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

Re: Problems using bison and flex with C++


From: Hans Aberg
Subject: Re: Problems using bison and flex with C++
Date: Sat, 26 Jun 2004 19:09:29 +0200

At 20:55 +0200 2004/06/25, Laurence Finston wrote:
>I've been assuming that the parser stack is also local to `yyparse()' when
>one generates a reentrant parser.  I've been planning to call `yyparse()'
>multiple times in multiple threads to read multiple input files. I haven't
>tried
>this out yet, and I've now rechecked the Bison manual, but haven't found
>anything to support this assumption.  Could somebody tell me whether it's
>correct?

The best way to find out is to look into the parser .c-file that Bison
outputs. I think that most likely, the stacks are not in the
parser-function.

Under C++, one can distinguish between the stacks being class-local and
function-local: Bison writes a C++ parser class, which contains a parser
function. Currently, the stack is put in the class, not the
parser-function. So it is class-local, but not function-local, and if
multiple stacks are needed, one will have to generate a new class
instantiation for each one. So, since this C++ parser derives from the
C-parser, I think that the C-parser stack is not function local, but
C-global, then.

I think this issue is a development issue, to be addressed in the Bug-Bison
list, then. If you make a C-version that is completely thread safe, you may
submit it for use in the Bison distribution (it is not difficult to rewrite
a Bison skeleton file). Perhaps Paul Eggert (cc'ed) knows more about this
issue.

  Hans Aberg






reply via email to

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