Hi Hans, item_list: >> | item_declaration item_list >> ; >> > > But sometimes one can do a trick by combining non-terminals into one rule. > Then the parse tree of those before will be constructed before those latter. > In your example, item_declaration will be constructed before item_list, so > one can have actions > item_declaration {...} item_list {...} > Here, the first action {...} can only use the item_declaration value, but > the second can use all that comes before. - See the Bison manual for > details.
At the end of that rule, the value of item_declaration is $1 and item_list is $2 and the overall return value is $$. What would be the value of item_declaration in my action if I put the latter just straight after it (not at the end of the rule)? item_list: | item_declaration { action1(&*$?*); } item_list { link_nodes(&$$); } Regards, Ilyes Gouta. _______________________________________________ help-bison@gnu.org http://lists.gnu.org/mailman/listinfo/help-bison