Sorry, my initial answer was not quite correct.
The way to do this in Bison is to access the semantic value of the
previous non-terminal in the parent rule as $0. For example:
A: B C D
C: X { $0 is the semantic value of B}
This is risky. One has to take care that in all places where a
non-terminal is referenced, the non-terminal bellow is the expected
one; or whatever it is, it has the expected semantic value.
In your example,
> Register_decl
> : REGISTER IDENTIFIER Register_decl_contd;
> Register_decl_contd
> : '.' IDENTIFIER ...something...
> { access register name as $0 ... }
> | '=' IDENTIFIER ...something...
> { idem ... }
> | '[' IDENTIFIER ...something...
> { idem }
But this is correct if the first line of this example contains the
only right hand side that has Register_decl_contd. Only in this case
it is safe to assume that IDENTIFIER is the semantic value stored
bellow in the stack.
Best regards,
Ramon
_______________________________________________
[email protected] http://lists.gnu.org/mailman/listinfo/help-bison