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: