Thanks for the reply
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?
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.
Could it be a good idea to extend yyUserMerge to allow for an extra
parameter?
Regards,
Michel Rosien
----- Original Message -----
From: "Laurence Finston" <[EMAIL PROTECTED]>
To: "Michel Rosien" <[EMAIL PROTECTED]>
Cc: <help-bison@gnu.org>
Sent: Tuesday, June 07, 2005 12:06 PM
Subject: Re: Additional Parameter to %merge function in glr-parsers
On Mon, 6 Jun 2005, Michel Rosien wrote:
Is it possible to pass an additional parameter to the %merge function in
glr-parsers?
I don't know, and I didn't find anything in the documentation that
addresses this question.
I can pass an additional parameter to the yyparse function with
%parse-param {...}
(bison 2.0 documentation, page 63, 107)
How can I pass that same argument to the %merge function?
(bison 2.0 documentation, page 19)
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. If you
have multiple calls to 'yyparse()', and it needs to be thread-safe,
then I suggest using thread-specific data containing a pointer
to that object (see "man pthread_key_create"). It might also turn
out to be advantageous to use a pointer to a pointer.
Laurence Finston
http://www.gnu.org/software/3dldf/LDF.html
_______________________________________________
Help-bison@gnu.org http://lists.gnu.org/mailman/listinfo/help-bison