# HG changeset patch # User Christian Urban # Date 1382745779 -3600 # Node ID b6eee9571a63b3dec3e56f5dada15b9f6ab25c79 # Parent 95eaee69563670ffcea37fd8b27bfcd750f1a02b added diff -r 95eaee695636 -r b6eee9571a63 handouts/ho05.pdf Binary file handouts/ho05.pdf has changed diff -r 95eaee695636 -r b6eee9571a63 handouts/ho05.tex --- a/handouts/ho05.tex Sat Oct 26 00:49:14 2013 +0100 +++ b/handouts/ho05.tex Sat Oct 26 01:02:59 2013 +0100 @@ -210,7 +210,33 @@ we can give the regular expression for \ref{Page ??} as follows Let us see how our algorithm for lexing works in detail. The regular -expressions and their ranking are shown above. +expressions and their ranking are shown above. For our algorithm it will +be helpful to have a look at the function \emph{zeroable} +defined as follows: + +\begin{center} +\begin{tabular}{@ {}l@ {\hspace{2mm}}c@ {\hspace{2mm}}l@ {}} +$zeroable(\varnothing)$ & $\dn$ & $true$\\ +$zeroable(\epsilon)$ & $\dn$ & $f\!alse$\\ +$zeroable (c)$ & $\dn$ & $f\!alse$\\ +$zeroable (r_1 + r_2)$ & $\dn$ & $zeroable(r_1) \wedge zeroable(r_2)$ \\ +$zeroable (r_1 \cdot r_2)$ & $\dn$ & $zeroable(r_1) \vee zeroable(r_2)$ \\ +$zeroable (r^*)$ & $\dn$ & $f\!alse$\\ +\end{tabular} +\end{center} + +\noindent +In contrast to the function $nullable(r)$, which test whether a regular expression +can match the empty string, the $zeroable$ function identifies whether a regular +expression cannot match anything at all. + +\begin{center} +\texttt{\Grid{$c_1$\VS{} true\VS{} then\VS{} x\VS{} else\VS{} y \ldots }} +\end{center} + +\noindent +The crucial idea of the algorithm is to build the derivative of all + \end{document} %%% Local Variables: diff -r 95eaee695636 -r b6eee9571a63 slides/slides05.pdf Binary file slides/slides05.pdf has changed diff -r 95eaee695636 -r b6eee9571a63 slides/slides05.tex --- a/slides/slides05.tex Sat Oct 26 00:49:14 2013 +0100 +++ b/slides/slides05.tex Sat Oct 26 01:02:59 2013 +0100 @@ -362,7 +362,7 @@ \mode{ \begin{frame}[c] -\mbox{\lstinputlisting[language=while]{../progs/loops.while}} +\mbox{\lstinputlisting[language=while]{../progs/collatz.while}} \begin{textblock}{6}(10,2) \begin{tikzpicture}[scale=0.46]