
300 Compilers – Principles and Practice
There are a few more compilation schemes which are of interest. The increment operator, ++, in
Java, C and C++ can be implemented using:
var++ = movl var,%eax ++var = incl var
incl var movl var,%eax
If var++ or ++var appears in an expression, then the final value in eax is important. If either appears
as a statement, then the final value is not important, and we can compile either as just incl var. We
can distinguish the different contexts by matching for ++ expressions both in the S and the E schemes.
Java, C and C++ provide two ways of escaping from a loop:
while(...){ while(...){
... ...
} cont:
}
past: ...