diff -r a359976a6f3e -r 975d34506e88 cws/cw04.tex --- a/cws/cw04.tex Mon Dec 10 02:23:30 2018 +0000 +++ b/cws/cw04.tex Fri Dec 14 14:41:54 2018 +0000 @@ -126,11 +126,11 @@ Since some tasks are time sensitive, you can check the reference implementation as follows: if you want to know, for example, how long it takes to match strings of $a$'s using the regular expression $(a^*)^*\cdot b$ -you can querry as follows: +you can query as follows: -\begin{lstlisting}[language={},xleftmargin=1mm,numbers=none,basicstyle=\ttfamily\small] +\begin{lstlisting}[xleftmargin=1mm,numbers=none,basicstyle=\ttfamily\small] $ scala -cp re.jar scala> import CW9a._ scala> for (i <- 0 to 5000000 by 500000) { @@ -231,7 +231,7 @@ \item[(2)] Implement a function, called \textit{der}, by recursion over regular expressions. It takes a character and a regular expression - as arguments and calculates the derivative regular expression according + as arguments and calculates the derivative of a xregular expression according to the rules: \begin{center} @@ -308,11 +308,11 @@ simplifies to just $r_1$. \textbf{Hint:} Regular expressions can be seen as trees and there are several methods for traversing - trees. One of them corresponds to the inside-out traversal, which is - sometimes also called post-order traversal: you traverse inside the + trees. One of them corresponds to the inside-out traversal, which is also + sometimes called post-order tra\-versal: you traverse inside the tree and on the way up you apply simplification rules. - Furthermore, - remember numerical expressions from school times: there you had expressions + \textbf{Another Hint:} + Remember numerical expressions from school times---there you had expressions like $u + \ldots + (1 \cdot x) - \ldots (z + (y \cdot 0)) \ldots$ and simplification rules that looked very similar to rules above. You would simplify such numerical expressions by replacing @@ -378,7 +378,7 @@ \] \noindent correctly to just \texttt{ONE}, where \texttt{SEQ} is nested - 50 or more times.\\ + 50 or more times?\\ \mbox{}\hfill[1 Mark] \end{itemize}