I would like to declare some variables that are local to yyparse. I am building a linked list of structures, and I need to make sure I have values for all the structure members before I add a new node to the list. Since I wrote the parser to be a pure parser, global variables, are not an option. Something like %initial-action {int x; int y; int z;} doesn't work, since the initial action code is enclosed in braces and the variables x,y,z,etc. do not exist outside the braces. 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. Is there a better way to do this? There must be a "standard" way this is done---temporarily saving all the previously parsed values until all the required values are available. Any help would be very appreciated. Thanks.

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

Reply via email to