diff -r 676e6484f29b -r bca9f8889a48 slides/slides02.tex --- a/slides/slides02.tex Tue Oct 03 23:35:16 2017 +0100 +++ b/slides/slides02.tex Wed Oct 04 08:46:09 2017 +0100 @@ -36,7 +36,7 @@ \begin{tabular}{ll} Email: & christian.urban at kcl.ac.uk\\ Office: & N7.07 (North Wing, Bush House)\\ - Slides: & KEATS + Slides: & KEATS (also homework is there) \end{tabular} \end{center} @@ -51,7 +51,7 @@ \footnotesize \begin{center} - {\normalsize Graphs: \bl{$a^{?\{n\}} \cdot a^{\{n\}}$} and strings \bl{$\underbrace{\,a\ldots a\,}_{n}$}}\\ + {\normalsize Graphs: \bl{$a^{?\{n\}} \cdot a^{\{n\}}$} and strings \bl{$\underbrace{\,a\ldots a\,}_{n}$}}\smallskip\\ \begin{tabular}{@{}cc@{}} \begin{tikzpicture} \begin{axis}[ @@ -69,8 +69,7 @@ height=4.5cm, legend entries={Python,Ruby}, legend pos=north west, - legend cell align=left -] + legend cell align=left] \addplot[blue,mark=*, mark options={fill=white}] table {re-python.data}; \addplot[brown,mark=pentagon*, mark options={fill=white}] table {re-ruby.data}; \end{axis} @@ -89,8 +88,10 @@ scaled ticks=false, axis lines=left, width=5cm, - height=4.5cm -] + height=4.5cm, + legend entries={Scala V2,Scala V3}, + legend pos=north west, + legend cell align=left] \addplot[green,mark=square*,mark options={fill=white}] table {re2.data}; \addplot[black,mark=square*,mark options={fill=white}] table {re3.data}; \end{axis} @@ -99,7 +100,7 @@ \end{center} \small -In the handouts is a similar graph with \bl{$(a^*)^* \cdot b$} for Java. +In the handouts is a similar graph for \bl{$(a^*)^* \cdot b$} and Java. \end{frame} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -175,9 +176,9 @@ \item[] For example \begin{center} -\begin{tabular}{lcll} -\bl{$A^4$} & \bl{$=$} & \bl{$A \,@\, A \,@\, A \,@\, A$} & \bl{$(\{[]\})$}\\ -\bl{$A^1$} & \bl{$=$} & \bl{$A$} & \bl{$(\{[]\})$}\\ +\begin{tabular}{lcl@{\hspace{10mm}}l} +\bl{$A^4$} & \bl{$=$} & \bl{$A \,@\, A \,@\, A \,@\, A$} & \bl{$(@\,\{[]\})$}\\ +\bl{$A^1$} & \bl{$=$} & \bl{$A$} & \bl{$(@\,\{[]\})$}\\ \bl{$A^0$} & \bl{$=$} & \bl{$\{[]\}$}\\ \end{tabular} \end{center} @@ -215,7 +216,7 @@ \frametitle{The Star Operation} \begin{itemize} -\item The \alert{\bf Star} of a \underline{language}: +\item The \alert{\bf Kleene Star} of a \underline{language}: \bigskip \begin{center} @@ -257,9 +258,9 @@ \end{tabular} \end{textblock} -\begin{textblock}{6}(9,12)\small +\begin{textblock}{9}(6,12)\small \bl{$L$} is a function from regular expressions to -sets of strings\\ +sets of strings (languages):\smallskip\\ \bl{$L$ : Rexp $\Rightarrow$ Set$[$String$]$} \end{textblock} @@ -332,9 +333,9 @@ \begin{textblock}{6}(2,7.5) \begin{tabular}{@ {}rrl@ {\hspace{13mm}}l} - \bl{$r$} & \bl{$::=$} & \bl{$\ZERO$} & null\\ + \bl{$r$} & \bl{$::=$} & \bl{$\ZERO$} & nothing\\ & \bl{$\mid$} & \bl{$\ONE$} & empty string / \pcode{""} / $[]$\\ - & \bl{$\mid$} & \bl{$c$} & character\\ + & \bl{$\mid$} & \bl{$c$} & single character\\ & \bl{$\mid$} & \bl{$r_1 \cdot r_2$} & sequence\\ & \bl{$\mid$} & \bl{$r_1 + r_2$} & alternative / choice\\ & \bl{$\mid$} & \bl{$r^*$} & star (zero or more)\\ @@ -614,7 +615,8 @@ \begin{frame}[c] \frametitle{Solving the Problem} -What happens if we extend our regular expressions +What happens if we extend our regular expressions with explicit +constructors \begin{center} \begin{tabular}{rcl} @@ -746,35 +748,35 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -\begin{frame}[c] -\frametitle{\bl{$(a^*)^* \cdot b$}} - -\begin{center} -\begin{tikzpicture} - \begin{axis}[ - xlabel={$n$}, - x label style={at={(1.09,0.0)}}, - ylabel={time in secs}, - enlargelimits=false, - xmax=27, - xtick={0,5,...,20}, - ytick={0,5,...,25}, - ymax=13, - scaled ticks=false, - axis lines=left, - width=9cm, - height=5cm, - legend entries={Scala V2}, - legend pos=north west, - legend cell align=left] -\addplot[green,mark=square*,mark options={fill=white}] table {re2a.data}; +%\begin{frame}[c] +%\frametitle{\bl{$(a^*)^* \cdot b$}} +% +%\begin{center} +%\begin{tikzpicture} +% \begin{axis}[ +% xlabel={$n$}, +% x label style={at={(1.09,0.0)}}, +% ylabel={time in secs}, +% enlargelimits=false, +% xmax=27, +% xtick={0,5,...,20}, +% ytick={0,5,...,25}, +% ymax=13, +% scaled ticks=false, +% axis lines=left, +% width=9cm, +% height=5cm, +% legend entries={Scala V2}, +% legend pos=north west, +% legend cell align=left] +%\addplot[green,mark=square*,mark options={fill=white}] table {re2a.data}; %% still needs to be done %%\addplot[black,mark=square*,mark options={fill=white}] table {re3a.data}; -\end{axis} -\end{tikzpicture} -\end{center} - -\end{frame} +%\end{axis} +%\end{tikzpicture} +%\end{center} +% +%\end{frame} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -788,15 +790,15 @@ x label style={at={(1.09,0.0)}}, ylabel={time in secs}, enlargelimits=false, - ytick={0,10,...,60}, - ymax=65, + ytick={0,10,...,30}, + ymax=35, axis lines=left, width=9cm, height=5cm, legend entries={Scala V3}, - legend pos=north west, + legend pos=north east, legend cell align=left] -\addplot[green,mark=square*,mark options={fill=white}] table {re2a.data}; +%\addplot[green,mark=square*,mark options={fill=white}] table {re2a.data}; \addplot[black,mark=square*,mark options={fill=white}] table {re3a.data}; \end{axis} \end{tikzpicture} @@ -818,7 +820,7 @@ \item is easy to implement in a functional language \item the algorithm is already quite old; there is still - work to be done to use it as a tokenizer (that is brand new work) + work to be done to use it as a tokenizer (that is relatively new work) \item we can prove its correctness\ldots \end{itemize}