due: Thursday, October 15, 11:59PM
if (x + 2 == 4) return x;
while (f(x,y)) x = x+f(y,x);
(a: int[], _) = (b, ((3, f) y));
(x:int, _) = ((1,2,3) 1, 0==1-1)
|
e2, to IR. In
particular, define
C⟦e1|
e2, t,
f⟧. (Hint: look at the translation of &.)
"foreach"
statement:foreach (x in e) s
The expression e must evaluate to an array.
The foreach
statement
executes the statement S once for each element of the array, with the
variable x bound to the array element at index i−1 on
iteration i. For example, this program:
use io main(args: string[]): int = { i: int = 0; a: int[] = (3,4,5); foreach (x in a) { println(unparseInt(x*10)); } }
30 40 50