diff -r 4e97783862ff -r d0fc671bcbbf coursework/cw02.tex --- a/coursework/cw02.tex Sun May 21 00:46:21 2017 +0100 +++ b/coursework/cw02.tex Sun May 21 07:35:35 2017 +0100 @@ -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$\\ @@ -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}