On 11 Jan 2009, at 18:37, Ilyes Gouta wrote:
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)?
See the Bison manual for details. They are implemented by inserting an
implicit non-terminal with an empty rule and an action. Given a rule
x: a {b} c {d} e {f}
then the action {d} can use $1 from a, $2 from the $$ that {b}
returns, and $3 from c, but not $4 (it should be $$ inside d) or $5 -
those can only be used in the action {f}.
Hans
_______________________________________________
help-bison@gnu.org http://lists.gnu.org/mailman/listinfo/help-bison