diff -r 86b2aeae3e98 -r a259eec25156 hws/hw04.tex --- a/hws/hw04.tex Fri Oct 16 14:27:20 2015 +0100 +++ b/hws/hw04.tex Sat Oct 17 11:24:41 2015 +0100 @@ -68,13 +68,34 @@ (Hint: You can assume you are already given a regular expression written \texttt{ALL}, that can recognise any character, and a regular expression \texttt{NOT} that recognises the complement of a regular expression.) + +\item Simplify the regular expression -\item How many basic regular expressions are there to match the string - $abcd$? (ii) How many if they cannot include $\epsilon$ and - $\varnothing$? (iii) How many if they are also not allowed to - contain stars? (iv) How many if they are also not allowed to contain - $\_ + \_$? +\[ +(\varnothing \cdot (b \cdot c)) + +((\varnothing \cdot c) + \epsilon) +\] + +Does simplification always preserve the meaning of a regular +expression? + +\item The Sulzmann algorithm contains the function $mkeps$ + which answers how a regular expression can match the + empty string. What is the answer of $mkeps$ for the + regular expressions: + \[ + \begin{array}{l} + (\varnothing \cdot (b \cdot c)) + + ((\varnothing \cdot c) + \epsilon)\\ + (a + \varepsilon) \cdot (\varepsilon + \varepsilon) + \end{array} + \] + +\item What is the purpose of the record regular expression + in the Sulzmann algorithm? + + %\item (Optional) The tokenizer in \texttt{regexp3.scala} takes as %argument a string and a list of rules. The result is a list of tokens. Improve this tokenizer so %that it filters out all comments and whitespace from the result.