next up previous
Next: About this document ... Up: Quiz7 Previous: Exercise 3.

Exercise 4.

This is a bonus exercise. You will receive 4 extra marks if you can explain how to modify the grammar and the type checker of Exercise 3 such that the revised language has As a hint, we give the revised rule for generating functions types
T $ \longmapsto$ A1$ \bf\rightarrow$$ \bf ($T2$ \bf )$
Here's a program that must be accepted by the revised grammar and type checker.
f: integer -> (integer -> (integer));
f(n: integer): integer -> (integer) == {
    g: integer -> (integer);
    g(m: integer): integer == { n + m; };
}
Only a brief explanation is needed, not a translation scheme.

Answer 4  
\fbox{
\begin{minipage}{15 cm}
One needs one symbol table for the global variabl...
...bf \{ } S_1 {\bf \} } $\ \\ \hline
\end{tabular}\end{center}\par
\end{minipage}}


next up previous
Next: About this document ... Up: Quiz7 Previous: Exercise 3.
Marc Moreno Maza
2004-12-02