help-bison
[Top][All Lists]
Advanced

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

initial-action question


From: Aaron Jackson
Subject: initial-action question
Date: Mon, 11 Feb 2008 03:17:02 -0500

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.




reply via email to

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