24 \newcommand{\bl}[1]{\textcolor{blue}{#1}}        | 
    24 \newcommand{\bl}[1]{\textcolor{blue}{#1}}        | 
    25   | 
    25   | 
    26   | 
    26   | 
    27 \begin{document} | 
    27 \begin{document} | 
    28   | 
    28   | 
         | 
    29   | 
         | 
    30   | 
    29 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%  | 
    31 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%  | 
    30 \begin{frame}[t] | 
    32 \begin{frame}[t] | 
    31 \frametitle{% | 
    33 \frametitle{% | 
    32   \begin{tabular}{@ {}c@ {}} | 
    34   \begin{tabular}{@ {}c@ {}} | 
    33   \\[-3mm]  | 
    35   \\[-3mm]  | 
    34   \LARGE Compilers and \\[-2mm]   | 
    36   \LARGE Compilers and \\[-2mm]   | 
    35   \LARGE Formal Languages\\[3mm]   | 
    37   \LARGE Formal Languages\\[-3mm]   | 
    36   \end{tabular}} | 
    38   \end{tabular}} | 
    37   | 
    39   | 
    38   \normalsize  | 
    40    \normalsize  | 
    39   \begin{center} | 
    41   \begin{center} | 
    40   \begin{tabular}{ll} | 
    42   \begin{tabular}{ll} | 
    41     Email:  & christian.urban at kcl.ac.uk\\  | 
    43   Email:  & christian.urban at kcl.ac.uk\\  | 
    42     %Office Hours: & Thursdays 12 -- 14\\  | 
    44   Office Hour: & Fridays 11 -- 12\\  | 
    43     %Location: & N7.07 (North Wing, Bush House)\\  | 
    45   Location: & N7.07 (North Wing, Bush House)\\  | 
    44     Slides \& Progs: & KEATS (also homework is there)\\    | 
    46   Slides \& Progs: & KEATS\\  | 
         | 
    47   Pollev: & \texttt{\alert{https://pollev.com/cfltutoratki576}}\\   | 
    45   \end{tabular} | 
    48   \end{tabular} | 
    46   \end{center} | 
    49   \end{center} | 
    47   | 
    50   | 
    48   \begin{center} | 
    51   \begin{center} | 
    49     \begin{tikzpicture} | 
    52     \begin{tikzpicture} | 
    59       };  | 
    62       };  | 
    60     \end{tikzpicture} | 
    63     \end{tikzpicture} | 
    61   \end{center} | 
    64   \end{center} | 
    62 \end{frame} | 
    65 \end{frame} | 
    63 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%  | 
    66 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%  | 
         | 
    67   | 
         | 
    68 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%  | 
         | 
    69 \begin{frame}[t,fragile] | 
         | 
    70 %%\frametitle{CW2} | 
         | 
    71   | 
         | 
    72 \small  | 
         | 
    73 \begin{textblock}{13}(-0.5,1) | 
         | 
    74 \begin{lstlisting}[numbers=none] | 
         | 
    75 def mkeps(r: Rexp) : Val = r match { | 
         | 
    76   ...  | 
         | 
    77   case PLUS(r) => Stars(List(mkeps(r)))   | 
         | 
    78   case OPTIONAL(r) => Stars(Nil)  | 
         | 
    79   case NTIMES(r, n) => Stars(List.fill(n)(mkeps(r)))  | 
         | 
    80 }  | 
         | 
    81   | 
         | 
    82 def inj(r: Rexp, c: Char, v: Val) : Val = (r, v) match { | 
         | 
    83   ...  | 
         | 
    84   case (RANGE(_), Empty) => Chr(c)  | 
         | 
    85   case (PLUS(r), Sequ(v1, Stars(vs))) => Stars(inj(r, c, v1)::vs)  | 
         | 
    86   case (OPTIONAL(r), v) => Stars(inj(r, c, v)::Nil)  | 
         | 
    87   case (NTIMES(r, n), Sequ(v1, Stars(vs))) => Stars(inj(r, c, v1)::vs)  | 
         | 
    88 }  | 
         | 
    89 \end{lstlisting} | 
         | 
    90 \end{textblock} | 
         | 
    91   | 
         | 
    92   | 
         | 
    93 \begin{textblock}{5}(3,13.5) | 
         | 
    94 \bl{$r^? \dn r^{\{0..1\}}$} | 
         | 
    95 \end{textblock} | 
         | 
    96   | 
         | 
    97 \end{frame} | 
         | 
    98 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%     | 
         | 
    99   | 
         | 
   100   | 
    64   | 
   101   | 
    65 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%  | 
   102 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%  | 
    66 % \begin{frame}[c] | 
   103 % \begin{frame}[c] | 
    67   | 
   104   | 
    68 % \begin{center} | 
   105 % \begin{center} |