Translation rules

Here are a few exercises for understanding translation rules from Java to Why.

  1. Here is a proposal for a simple rule for translating field incrementation:
      [[e.f++]]=[[e.f = e.f+1]]

    Show why it is not correct, and propose a correct translation rule.

  2. Propose a translation rule for the for loop:
    for(e1 ; e2 ; e3) s
  3. Propose translation rules for break and continue with labels, and modify translation rule of the while loop accordingly.
  4. Propose translation rules for the switch statement.

This document was translated from LATEX by HEVEA.