--- a/slides/slides03.tex Fri Oct 07 22:08:03 2016 +0100
+++ b/slides/slides03.tex Sat Oct 08 13:45:30 2016 +0100
@@ -11,7 +11,7 @@
\newcommand{\bl}[1]{\textcolor{blue}{#1}}
% beamer stuff
-\renewcommand{\slidecaption}{AFL 03, King's College London}
+\renewcommand{\slidecaption}{CFL 03, King's College London}
\begin{document}
@@ -20,7 +20,7 @@
\frametitle{%
\begin{tabular}{@ {}c@ {}}
\\[-3mm]
- \LARGE Automata and \\[-2mm]
+ \LARGE Compilers and \\[-2mm]
\LARGE Formal Languages (3)\\[3mm]
\end{tabular}}
@@ -34,7 +34,20 @@
\end{center}
\end{frame}
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\begin{frame}[c]
+\frametitle{Scala Book, Exams}
+
+\begin{itemize}
+\item www.inf.kcl.ac.uk/~urbanc/ProgInScala2ed.pdf
+\item homeworks (exam 80\%)
+\item coursework (20\%)
+\end{itemize}
+
+\end{frame}
+%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{frame}[c]
@@ -79,9 +92,9 @@
\begin{center}
\begin{tabular}{@ {}l@ {\hspace{2mm}}c@ {\hspace{2mm}}l@ {\hspace{-10mm}}l@ {}}
- \bl{$der\, c\, (\varnothing)$} & \bl{$\dn$} & \bl{$\varnothing$} & \\
- \bl{$der\, c\, (\epsilon)$} & \bl{$\dn$} & \bl{$\varnothing$} & \\
- \bl{$der\, c\, (d)$} & \bl{$\dn$} & \bl{if $c = d$ then $\epsilon$ else $\varnothing$} & \\
+ \bl{$der\, c\, (\ZERO)$} & \bl{$\dn$} & \bl{$\ZERO$} & \\
+ \bl{$der\, c\, (\ONE)$} & \bl{$\dn$} & \bl{$\ZERO$} & \\
+ \bl{$der\, c\, (d)$} & \bl{$\dn$} & \bl{if $c = d$ then $\ONE$ else $\ZERO$} & \\
\bl{$der\, c\, (r_1 + r_2)$} & \bl{$\dn$} & \bl{$der\, c\, r_1 + der\, c\, r_2$} & \\
\bl{$der\, c\, (r_1 \cdot r_2)$} & \bl{$\dn$} & \bl{if $nullable (r_1)$}\\
& & \bl{then $(der\,c\,r_1) \cdot r_2 + der\, c\, r_2$}\\
@@ -120,7 +133,7 @@
\bl{$nullable(r)$} \;if and only if\; \bl{$[] \in L(r)$}
\end{center}
-by induction on the regular expression.\bigskip\pause
+by induction on the regular expression \bl{$r$}.\bigskip\pause
\begin{center}
{\huge\bf\alert{Any Questions?}}
@@ -138,7 +151,7 @@
\bl{$L(der\,c\,r) = Der\,c\,(L(r))$}
\end{center}
-by induction on the regular expression.
+also by induction on the regular expression \bl{$r$}.
\end{frame}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -147,7 +160,7 @@
\frametitle{Proofs about Rexps}
\begin{itemize}
-\item \bl{$P$} holds for \bl{$\varnothing$}, \bl{$\epsilon$} and \bl{c}\bigskip
+\item \bl{$P$} holds for \bl{$\ZERO$}, \bl{$\ONE$} and \bl{c}\bigskip
\item \bl{$P$} holds for \bl{$r_1 + r_2$} under the assumption that \bl{$P$} already
holds for \bl{$r_1$} and \bl{$r_2$}.\bigskip
\item \bl{$P$} holds for \bl{$r_1 \cdot r_2$} under the assumption that \bl{$P$} already
@@ -184,8 +197,8 @@
\begin{center}
\begin{tabular}{@ {}rrl@ {\hspace{13mm}}l}
- \bl{$r$} & \bl{$::=$} & \bl{$\varnothing$} & null\\
- & \bl{$\mid$} & \bl{$\epsilon$} & empty string / "" / $[]$\\
+ \bl{$r$} & \bl{$::=$} & \bl{$\ZERO$} & null\\
+ & \bl{$\mid$} & \bl{$\ONE$} & empty string / "" / $[]$\\
& \bl{$\mid$} & \bl{$c$} & character\\
& \bl{$\mid$} & \bl{$r_1 \cdot r_2$} & sequence\\
& \bl{$\mid$} & \bl{$r_1 + r_2$} & alternative / choice\\
@@ -473,11 +486,11 @@
\begin{center}
\begin{tabular}[t]{l@{\hspace{10mm}}l}
-\raisebox{1mm}{\bl{$\varnothing$}} &
+\raisebox{1mm}{\bl{$\ZERO$}} &
\begin{tikzpicture}[scale=0.7,>=stealth',very thick, every state/.style={minimum size=3pt,draw=blue!50,very thick,fill=blue!20},]
\node[state, initial] (q_0) {$\mbox{}$};
\end{tikzpicture}\\\\
-\raisebox{1mm}{\bl{$\epsilon$}} &
+\raisebox{1mm}{\bl{$\ONE$}} &
\begin{tikzpicture}[scale=0.7,>=stealth',very thick, every state/.style={minimum size=3pt,draw=blue!50,very thick,fill=blue!20},]
\node[state, initial, accepting] (q_0) {$\mbox{}$};
\end{tikzpicture}\\\\
@@ -715,7 +728,7 @@
\footnotesize
\begin{center}
\begin{tabular}{ll}
-DFA: & NFA:\\
+DFA: & (original) NFA:\\
\raisebox{10mm}{%
\begin{tikzpicture}[scale=0.7,>=stealth',very thick,
every state/.style={minimum size=0pt,
@@ -1053,6 +1066,7 @@
\end{center}\pause\bigskip
\onslide<2->{
+You know how to solve since school days, no?
\begin{center}
\begin{tabular}{r@ {\hspace{2mm}}c@ {\hspace{2mm}}l}
\bl{$q_0$} & \bl{$=$} & \bl{$2\, q_0 + 3 \,q_1 + 4\, q_2$}\\
@@ -1088,7 +1102,7 @@
\onslide<2->{
\begin{center}
\begin{tabular}{r@ {\hspace{2mm}}c@ {\hspace{2mm}}l}
-\bl{$q_0$} & \bl{$=$} & \bl{$\epsilon + q_0\,b + q_1\,b + q_2\,b$}\\
+\bl{$q_0$} & \bl{$=$} & \bl{$\ONE + q_0\,b + q_1\,b + q_2\,b$}\\
\bl{$q_1$} & \bl{$=$} & \bl{$q_0\,a$}\\
\bl{$q_2$} & \bl{$=$} & \bl{$q_1\,a + q_2\,a$}\\
@@ -1151,8 +1165,8 @@
\begin{center}
\bl{\begin{tabular}{r@{\hspace{1mm}}c@{\hspace{1mm}}l}
-$rev(\varnothing)$ & $\dn$ & $\varnothing$\\
-$rev(\epsilon)$ & $\dn$ & $\epsilon$\\
+$rev(\ZERO)$ & $\dn$ & $\ZERO$\\
+$rev(\ONE)$ & $\dn$ & $\ONE$\\
$rev(c)$ & $\dn$ & $c$\\
$rev(r_1 + r_2)$ & $\dn$ & $rev(r_1) + rev(r_2)$\\
$rev(r_1 \cdot r_2)$ & $\dn$ & $rev(r_2) \cdot rev(r_1)$\\