--- a/coursework/cw02.tex Tue Sep 26 14:07:29 2017 +0100
+++ b/coursework/cw02.tex Tue Sep 26 14:08:49 2017 +0100
@@ -6,7 +6,7 @@
\section*{Coursework 2 (Strand 1)}
-\noindent This coursework is worth 5\% and is due on 4
+\noindent This coursework is worth 5\% and is due on 3
November at 16:00. You are asked to implement the Sulzmann \&
Lu lexer for the WHILE language. You can do the
implementation in any programming language you like, but you
@@ -88,7 +88,7 @@
\begin{center}
\begin{tabular}{ll}
-$[c_1 c_2 \ldots c_n]$ & a range of characters\\
+$[c_1,c_2,\ldots,c_n]$ & a set of characters\\
$r^+$ & one or more times $r$\\
$r^?$ & optional $r$\\
$r^{\{n\}}$ & n-times $r$\\
@@ -96,7 +96,7 @@
\end{center}
\noindent
-Later on you will also need the record regular expressions:
+Later on you will also need the record regular expression:
\begin{center}
\begin{tabular}{ll}
@@ -105,8 +105,9 @@
\end{center}
\noindent Try to design your regular expressions to be as
-small as possible. For example you should use character ranges
-for identifiers and numbers.
+small as possible. For example you should use character sets
+for identifiers and numbers. Feel free to use the general
+character constructor \textit{CFUN} introduced in CW 1.
\subsection*{Question 2}
@@ -119,11 +120,11 @@
\begin{center}
\begin{tabular}{@ {}l@ {\hspace{2mm}}c@ {\hspace{2mm}}l@ {}}
-$mkeps([c_1 c_2 \ldots c_n])$ & $\dn$ & $?$\\
+$mkeps([c_1,c_2,\ldots,c_n])$ & $\dn$ & $?$\\
$mkeps(r^+)$ & $\dn$ & $?$\\
$mkeps(r^?)$ & $\dn$ & $?$\\
$mkeps(r^{\{n\}})$ & $\dn$ & $?$\medskip\\
-$inj\, ([c_1 c_2 \ldots c_n])\,c\,\ldots$ & $\dn$ & $?$\\
+$inj\, ([c_1,c_2,\ldots,c_n])\,c\,\ldots$ & $\dn$ & $?$\\
$inj\, (r^+)\,c\,\ldots$ & $\dn$ & $?$\\
$inj\, (r^?)\,c\,\ldots$ & $\dn$ & $?$\\
$inj\, (r^{\{n\}})\,c\,\ldots$ & $\dn$ & $?$\\
@@ -175,16 +176,12 @@
\begin{figure}[p]
-\begin{center}
\mbox{\lstinputlisting[language=while]{../progs/fib.while}}
-\end{center}
\caption{Fibonacci program in the WHILE language.\label{fib}}
\end{figure}
\begin{figure}[p]
-\begin{center}
\mbox{\lstinputlisting[language=while]{../progs/loops.while}}
-\end{center}
\caption{The three-nested-loops program in the WHILE language.
Usually used for timing measurements.\label{loop}}
\end{figure}