[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Top Dowm Variable Communication
From: |
Ramón García |
Subject: |
Re: Top Dowm Variable Communication |
Date: |
Sat, 25 Aug 2007 04:41:18 +0200 |
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
- shift/reduce conflict with unary, cwcaceres, 2007/08/21
- Re: shift/reduce conflict with unary, Derek M Jones, 2007/08/21
- Re: shift/reduce conflict with unary, cwcaceres, 2007/08/21
- Re: shift/reduce conflict with unary, Derek M Jones, 2007/08/21
- Re: shift/reduce conflict with unary, cwcaceres, 2007/08/22
- Top Dowm Variable Communication, Arijit Das, 2007/08/22
- Message not available
- Re: Top Dowm Variable Communication, Ramón García, 2007/08/22
- Re: Top Dowm Variable Communication, Evan Lavelle, 2007/08/22
- Re: Top Dowm Variable Communication, Evan Lavelle, 2007/08/22
- Message not available
- Re: Top Dowm Variable Communication, lfinsto1, 2007/08/22
- Re: Top Dowm Variable Communication,
Ramón García <=
- Re: shift/reduce conflict with unary, Evan Lavelle, 2007/08/22
- Re: shift/reduce conflict with unary, cwcaceres, 2007/08/22
- Re: shift/reduce conflict with unary, Evan Lavelle, 2007/08/22
- Re: shift/reduce conflict with unary, cwcaceres, 2007/08/22
- Re: shift/reduce conflict with unary, Evan Lavelle, 2007/08/22