Slide 9.3: Reduction rules of assignments
Slide 9.5: Reduction rules of assignments (cont.)
Home

Reduction Rules of Assignments (Cont.)

  1.            <E|Env> ⇒ <E1|Env>           
    <E '*' E2 | Env> ⇒ <E1 '*' E2 | Env>
  2.            <E|Env> ⇒ <E1|Env>           
    <V '+' E | Env> ⇒ <V '+' E1 | Env>
  3.            <E|Env> ⇒ <E1|Env>           
    <V '–' E | Env> ⇒ <V '–' E1 | Env>
  4.            <E|Env> ⇒ <E1|Env>           
    <V '*' E | Env> ⇒ <V '*' E1 | Env>
  5.            <E|Env> ⇒ <E1|Env>           
    <'(' E ')' | Env> ⇒ <'(' E1 ')' | Env>
  6.      <E|Env> ⇒ <E1|Env>, <E1|Env> ⇒ <E2|Env>     
    <E|Env> ⇒ <E2|Env>
The one case of evaluation that explicitly involves the environment is when an expression is an identifier I:
  1.          Env(I) = V         
    <I|Env> ⇒ <V|Env>
This states that if the value of identifier 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
  1. <I ':=' V | Env> ⇒ Env & {I=V}
which states that the assignment of the value V to I in environment Env reduces to a new environment where I is equal to V.