On Mon, 11 Feb 2008, Aaron Jackson wrote: > I would like to declare some variables that are local to yyparse.
> If I use %parse-param{variables_t variables;}, > where variables_t is a structure containing x,y,z, I get what I want, but > since I don't need x,y,z after yyparse returns, this seems like an inefficient > way to do things. I see two advantages of the %parse-param approach that, in my mind, outweigh the disadvantage of writing a few extra lines of code. First, Bison can easily make the %parse-param variables accessible to all parser functions including Bison-generated internal functions that the user doesn't normally invoke directly. Second, for push parsing, the main parser function is invoked multiple times, so state variables cannot be local to it. You may argue that these advantages are irrelevant to your use case. I feel it's better not to customize Bison's interfaces perfectly for every possible use case. Instead, I think we need to balance such customization with simple generalizations for the Bison project as a whole. You might consider wrapping yyparse in your own function that allocates your %parse-param variables on the stack. _______________________________________________ help-bison@gnu.org http://lists.gnu.org/mailman/listinfo/help-bison