On Tue, 7 Jun 2005, Michel Rosien wrote:

> Thanks for the reply

You're welcome.

>
> > If it's not possible, and you only call 'yyparse()' once,
> > then I think you might as well use a globally or statically declared
> > pointer to point to the object referenced by your parameter.
>
> This is what I do as a 'quick hack' now but doesn't it kind of defeat the
> purpose of
> %pure-parser?

It depends.  If you were only using it for the sake of the parameter and
didn't plan to call 'yyparse()' asynchronously, then it wouldn't matter.

> The problem I have now is that I want to call my parser recursively and then
> the global pointer
> solution doesn't work
>  I can solve it I think by maintaining some kind of global stack of pointers
> that I push/pop each time I enter/leave
> a recursive call of yyparse(). But to me it seems this is a very big
> work-arround that shouldn't be necessary.

I think spawning a thread for each call to 'yyparse()' would be
a better solution and would improve performance in comparison to
synchronous recursive calls.  On the other hand, I don't believe
that the overhead of maintaining a global stack of pointers
would be too onerous.  Global variables have gotten a bad press,
but sometimes they're the right tool for the job.  On the other hand,
maybe it's possible to pass the parameter to your merging functions,
after all.  Someone who knows will have to answer this.

Laurence


_______________________________________________
Help-bison@gnu.org http://lists.gnu.org/mailman/listinfo/help-bison

Reply via email to