cws/cw03.tex
changeset 950 fa97d2f60f11
parent 943 5365ef60707e
child 956 ae9782e62bdd
--- a/cws/cw03.tex	Mon Oct 30 12:58:45 2023 +0000
+++ b/cws/cw03.tex	Mon Oct 30 15:08:40 2023 +0000
@@ -2,6 +2,7 @@
 \documentclass{article}
 \usepackage{../style}
 \usepackage{../langs}
+\usepackage[normalem]{ulem}
 
 \begin{document}
 
@@ -128,10 +129,47 @@
 if-statement will ``run'' the if-branch if the boolean
 evaluates to \pcode{true}, otherwise the else-branch.
 Loops should be run as long as the boolean is \pcode{true}.
+Note also that some programs contain a read-statement,
+which means you need to read and integer from the commandline
+and store the value in the corresponding variable.
 Programs you should be able to run are shown in
-Figures \ref{fib} -- \ref{collatz}.
+Figures \ref{fib} -- \ref{collatz}. The output
+of the \texttt{primes.while} should look as follows:
 
+\begin{figure}[h]
+{\small
+\begin{lstlisting}[numbers=none]
+2
+3
+5
+7
+11
+13
+17
+19
+23
+29
+31
+37
+41
+43
+47
+53
+59
+61
+67
+71
+73
+79
+83
+89
+97
+Map(end -> 100, n -> 100, f -> 4, tmp -> 1)
+\end{lstlisting}}
+\caption{Sample output for the file \texttt{primes.while}.\label{fib}}
+\end{figure}
 
+\noindent
 Give some time measurements for your interpreter
 and the loop program in Figure~\ref{loop}. For example
 how long does your interpreter take when \pcode{start}
@@ -139,6 +177,8 @@
 you scale this value if you are willing to wait, say
 1 Minute?
 
+\clearpage
+
 \begin{figure}[h]
 \lstinputlisting[language=while,xleftmargin=20mm]{../cwtests/cw03/fib.while}
 \caption{Fibonacci program in the WHILE language.\label{fib}}
@@ -165,13 +205,21 @@
 \newpage
 \section*{Answers}
 
+\mbox{}  
+
+\noindent
+\textbf{Name:}\uline{\hfill}\bigskip
+
+
+
 \noindent
 \textbf{Question 1 (Grammar):}\\
 
 \mbox{}\\[9cm]
 
+\newpage
 \noindent
-\textbf{Question 2 (Prase Tree):}\\
+\textbf{Question 2 (Parse Tree):}\\
 
 \mbox{}\\[8cm]