diff -r 4755ad4b457b -r 8890852e18b7 coursework/cw04.tex --- a/coursework/cw04.tex Fri Sep 25 20:59:24 2015 +0100 +++ b/coursework/cw04.tex Mon Sep 28 23:47:34 2015 +0100 @@ -88,7 +88,7 @@ \caption{The Fibonacci program in the WHILE language.\label{fibs}} \end{figure} -\subsection*{Question 2 (marked with 5\%)} +\subsection*{Question 2 (marked with 4\%)} Extend the syntax of you language so that it contains also \texttt{for}-loops, like @@ -133,6 +133,8 @@ \end{minipage} \end{center} +\subsection*{Question 3 (marked with 1\%)} + \noindent In this question you are supposed to give the assembler instructions for the program @@ -140,9 +142,9 @@ \begin{center} \begin{minipage}{6cm} \begin{lstlisting}[language=While,basicstyle=\ttfamily, numbers=none] -for i := 1 upto 10000 do { - for i := 1 upto 10000 do { - skip +for i := 1 upto 10 do { + for i := 1 upto 10 do { + write i } } \end{lstlisting} @@ -152,6 +154,8 @@ \noindent Note that in this program the variable \pcode{i} is used twice. You need to make a decision how it should be compiled? +Explain you decision and indicate what this program would +print out. \subsection*{Further Information}