Slide 9.3: Reduction rules of assignments Slide 9.5: Reduction rules of assignments (cont.) Home |
<E|Env> ⇒ <E1|Env>
<E '*' E2 | Env> ⇒ <E1 '*' E2 | Env>
<E|Env> ⇒ <E1|Env>
<V '+' E | Env> ⇒ <V '+' E1 | Env>
<E|Env> ⇒ <E1|Env>
<V '–' E | Env> ⇒ <V '–' E1 | Env>
<E|Env> ⇒ <E1|Env>
<V '*' E | Env> ⇒ <V '*' E1 | Env>
<E|Env> ⇒ <E1|Env>
<'(' E ')' | Env> ⇒ <'(' E1 ')' | Env>
<E|Env> ⇒ <E1|Env>, <E1|Env> ⇒ <E2|Env>
<E|Env> ⇒ <E2|Env>
I
:
Env(I) = V
<I|Env> ⇒ <V|Env>
I
is V
in environment Env
, then I
reduces to V
in the presence of Env
.
It remains to add assignment statements and statement sequences to the reduction rules.
First, statements must reduce to environments instead of integer values, since they create and change environments.
Thus, we have
<I ':=' V | Env> ⇒ Env & {I=V}
V
to I
in environment Env
reduces to a new environment where I
is equal to V
.