Dear All,
There has been quite a bit of discussions of the lab deadlines. The most important principle is that they should not extend to the next study period, because they would then interfere with the new courses. This gives us some room to extend the final deadline - which is also motivated by the work needed for the exam. Hence,
The final deadline for all returns is now Sunday 20 March at 18.00
However, there is no reason to extend the lab 4 first deadline itself - as usual, we want to know who is still in, and you should submit an empty or partial lab with a cover letter by the deadline of this evening so that we know.
My best advice for lab 4 is: read the lab spec and lecture 10 carefully. Take the semantic rules, which fit on one slide, and implement them by the normal principles of syntax-directed translation. Just a reminder what the resulting pseudocode is, for the key cases:
eval env (\x -> b) =
return \x -> b // i.e. do nothing!
eval env (f a) =
\x -> b := eval env f
v := eval env a // this is call by value; for call by name, just use a
eval env (subst (x,v) b)
eval env (a + b) =
u := eval env a
v := eval env b
return u + v
eval env (if c then a else b) =
v := eval env c
if (v != 0) eval env a ; else eval env b
To keep it simple, this is all you really need. Stacks, closures, etc, are smart optimizations that you may add later if you are ambitious, but the direct translation of the semantics is as above. You should be able to write the code in less than 90 minutes and have one hour left for testing :-)
Regards
Aarne.