slides/slides08.tex
changeset 899 569a3adb6e01
parent 871 94b84d880c2b
child 940 46eee459a999
--- a/slides/slides08.tex	Thu Nov 24 19:05:34 2022 +0000
+++ b/slides/slides08.tex	Thu Dec 01 12:51:49 2022 +0000
@@ -26,22 +26,25 @@
 
 \begin{document}
 
+
+
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 \begin{frame}[t]
 \frametitle{%
   \begin{tabular}{@ {}c@ {}}
   \\[-3mm]
   \LARGE Compilers and \\[-2mm] 
-  \LARGE Formal Languages\\[3mm] 
+  \LARGE Formal Languages\\[-3mm] 
   \end{tabular}}
 
-  \normalsize
+   \normalsize
   \begin{center}
   \begin{tabular}{ll}
-    Email:  & christian.urban at kcl.ac.uk\\
-    %Office Hours: & Thursdays 12 -- 14\\
-    %Location: & N7.07 (North Wing, Bush House)\\
-    Slides \& Progs: & KEATS (also homework is there)\\  
+  Email:  & christian.urban at kcl.ac.uk\\
+  Office Hour: & Fridays 11 -- 12\\
+  Location: & N7.07 (North Wing, Bush House)\\
+  Slides \& Progs: & KEATS\\
+  Pollev: & \texttt{\alert{https://pollev.com/cfltutoratki576}}\\  
   \end{tabular}
   \end{center}
 
@@ -62,6 +65,40 @@
 \end{frame}
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\begin{frame}[t,fragile]
+%%\frametitle{CW2}
+
+\small
+\begin{textblock}{13}(-0.5,1)
+\begin{lstlisting}[numbers=none]
+def mkeps(r: Rexp) : Val = r match {
+  ...
+  case PLUS(r) => Stars(List(mkeps(r))) 
+  case OPTIONAL(r) => Stars(Nil)
+  case NTIMES(r, n) => Stars(List.fill(n)(mkeps(r)))
+}
+
+def inj(r: Rexp, c: Char, v: Val) : Val = (r, v) match {
+  ...
+  case (RANGE(_), Empty) => Chr(c)
+  case (PLUS(r), Sequ(v1, Stars(vs))) => Stars(inj(r, c, v1)::vs)
+  case (OPTIONAL(r), v) => Stars(inj(r, c, v)::Nil)
+  case (NTIMES(r, n), Sequ(v1, Stars(vs))) => Stars(inj(r, c, v1)::vs)
+}
+\end{lstlisting}
+\end{textblock}
+
+
+\begin{textblock}{5}(3,13.5)
+\bl{$r^? \dn r^{\{0..1\}}$}
+\end{textblock}
+
+\end{frame}
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
+
+
+
 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 % \begin{frame}[c]