| 876 |      1 | % !TEX program = xelatex
 | 
|  |      2 | \documentclass[dvipsnames,14pt,t,xelatex,aspectratio=169,xcolor={table}]{beamer}
 | 
|  |      3 | \usepackage{../slides}
 | 
|  |      4 | \usepackage{../graphicss}
 | 
|  |      5 | \usepackage{../langs}
 | 
|  |      6 | \usepackage{../data}
 | 
|  |      7 | \usetikzlibrary{cd}
 | 
| 929 |      8 | \usepackage{listings-rust}
 | 
| 964 |      9 | \usepackage{ulem}
 | 
| 876 |     10 | 
 | 
|  |     11 | \usepackage{tcolorbox}
 | 
|  |     12 | \newtcolorbox{mybox}{colback=red!5!white,colframe=red!75!black}
 | 
|  |     13 | \newtcolorbox{mybox2}[1]{colback=red!5!white,colframe=red!75!black,fonttitle=\bfseries,title=#1}
 | 
|  |     14 | \newtcolorbox{mybox3}[1]{colback=Cyan!5!white,colframe=Cyan!75!black,fonttitle=\bfseries,title=#1}
 | 
|  |     15 | 
 | 
|  |     16 | 
 | 
|  |     17 | 
 | 
|  |     18 | \hfuzz=220pt 
 | 
|  |     19 | 
 | 
|  |     20 | \lstset{language=Scala,
 | 
|  |     21 |         style=mystyle,
 | 
|  |     22 |         numbersep=0pt,
 | 
|  |     23 |         numbers=none,
 | 
|  |     24 |         xleftmargin=0mm}
 | 
|  |     25 | 
 | 
|  |     26 | \newcommand{\bl}[1]{\textcolor{blue}{#1}}     
 | 
|  |     27 |  
 | 
|  |     28 | % beamer stuff 
 | 
|  |     29 | \renewcommand{\slidecaption}{CFL 01, King's College London}
 | 
|  |     30 | 
 | 
|  |     31 | %% https://cs.rit.edu/~hh/teaching/_media/cc18/lectures/lect1/main.pdf
 | 
|  |     32 | %% https://cs.rit.edu/~hh/teaching/_media/cc18/lectures/lect2/main.pdf
 | 
|  |     33 | %% https://cs.rit.edu/~hh/teaching/_media/cc18/lectures/lect3/main.pdf
 | 
|  |     34 | 
 | 
| 928 |     35 | 
 | 
| 876 |     36 | \begin{document}
 | 
|  |     37 | 
 | 
|  |     38 | %\begin{frame}[t]
 | 
|  |     39 | %
 | 
|  |     40 | %\begin{mybox}
 | 
|  |     41 | %A physical explanation the \emph{dynamic matrix}\\
 | 
|  |     42 | %lots of text
 | 
|  |     43 | %\end{mybox}
 | 
|  |     44 | 
 | 
|  |     45 | 
 | 
|  |     46 | %\begin{mybox2}{Test}
 | 
|  |     47 | %A physical explanation the \emph{dynamic matrix}\\
 | 
|  |     48 | %lots of text
 | 
|  |     49 | %\end{mybox2}
 | 
|  |     50 | 
 | 
|  |     51 | %\begin{mybox3}{Test}
 | 
|  |     52 | %A physical explanation the \emph{dynamic matrix}\\
 | 
|  |     53 | %lots of text
 | 
|  |     54 | %\end{mybox3}
 | 
| 906 |     55 | % \end{frame}
 | 
|  |     56 | 
 | 
|  |     57 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 | 
| 921 |     58 | %\begin{frame}[t]
 | 
|  |     59 | %\frametitle{%  
 | 
|  |     60 | %  \begin{tabular}{@ {}c@ {}}
 | 
|  |     61 | %  \\[-3mm]
 | 
|  |     62 | %  \LARGE Lunch with a Lecturer (29 March)\\[5mm] 
 | 
|  |     63 | %  \end{tabular}}
 | 
|  |     64 | %
 | 
|  |     65 | %  I teach CFL (compilers) and PEP (Scala)\bigskip
 | 
|  |     66 | %
 | 
|  |     67 | %  \begin{itemize}
 | 
|  |     68 | %  \item did undergraduate in Germany
 | 
|  |     69 | %  \item Master in St Andrews
 | 
|  |     70 | %  \item PhD in Cambridge  
 | 
|  |     71 | %  \end{itemize}\bigskip\bigskip
 | 
|  |     72 | %
 | 
|  |     73 | %  use mainly the Isabelle theorem prover in my work (see 6CCS3VER)
 | 
|  |     74 | %
 | 
|  |     75 | %  write code in functional programming languages (Scala, SML, Ocaml, Haskell)
 | 
|  |     76 | %\end{frame}
 | 
| 906 |     77 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 | 
|  |     78 | 
 | 
| 921 |     79 | % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 | 
|  |     80 | % \begin{frame}[c]
 | 
|  |     81 | % \frametitle{Why Bother with Regexes?}
 | 
| 906 |     82 | 
 | 
| 921 |     83 | % \begin{columns}[t,onlytextwidth]
 | 
|  |     84 | % \begin{column}{1.8cm}
 | 
|  |     85 | % \mbox{}   
 | 
|  |     86 | % \end{column}    
 | 
|  |     87 | % \begin{column}{.5\textwidth}
 | 
|  |     88 | % \small{}Ruby, Python, Java 8\medskip\\
 | 
|  |     89 | % \begin{tikzpicture}\footnotesize
 | 
|  |     90 | % \begin{axis}[
 | 
|  |     91 | %     xlabel={$n$},
 | 
|  |     92 | %     x label style={at={(1.05,0.0)}},
 | 
|  |     93 | %     ylabel={time in secs},
 | 
|  |     94 | %     enlargelimits=false,
 | 
|  |     95 | %     xtick={0,5,...,30},
 | 
|  |     96 | %     xmax=33,
 | 
|  |     97 | %     ymax=35,
 | 
|  |     98 | %     ytick={0,5,...,30},
 | 
|  |     99 | %     scaled ticks=false,
 | 
|  |    100 | %     axis lines=left,
 | 
|  |    101 | %     width=\textwidth,
 | 
|  |    102 | %     height=4cm, 
 | 
|  |    103 | %     legend entries={Python,Ruby},  
 | 
|  |    104 | %     legend pos=north west,
 | 
|  |    105 | %     legend cell align=left]
 | 
|  |    106 | % \addplot[blue,mark=*, mark options={fill=white}] table {re-python.data};
 | 
|  |    107 | % \addplot[brown,mark=triangle*, mark options={fill=white}] table {re-ruby.data};
 | 
|  |    108 | % \end{axis}
 | 
|  |    109 | % \end{tikzpicture}
 | 
|  |    110 | % \begin{tikzpicture}\footnotesize
 | 
|  |    111 | % \begin{axis}[
 | 
|  |    112 | %     xlabel={$n$},
 | 
|  |    113 | %     x label style={at={(1.05,0.0)}},
 | 
|  |    114 | %     ylabel={time in secs},
 | 
|  |    115 | %     enlargelimits=false,
 | 
|  |    116 | %     xtick={0,5,...,30},
 | 
|  |    117 | %     xmax=33,
 | 
|  |    118 | %     ymax=35,
 | 
|  |    119 | %     ytick={0,5,...,30},
 | 
|  |    120 | %     scaled ticks=false,
 | 
|  |    121 | %     axis lines=left,
 | 
|  |    122 | %     width=\textwidth,
 | 
|  |    123 | %     height=4cm, 
 | 
|  |    124 | %     legend entries={Python, Java 8, JavaScript, Swift},  
 | 
|  |    125 | %     legend pos=north west,
 | 
|  |    126 | %     legend cell align=left]
 | 
|  |    127 | % \addplot[blue,mark=*, mark options={fill=white}] table {re-python2.data};   
 | 
|  |    128 | % \addplot[cyan,mark=*, mark options={fill=white}] table {re-java.data};
 | 
|  |    129 | % \addplot[red,mark=*, mark options={fill=white}] table {re-js.data};
 | 
|  |    130 | % \addplot[magenta,mark=*, mark options={fill=white}] table {re-swift.data};
 | 
|  |    131 | % \end{axis}
 | 
|  |    132 | % \end{tikzpicture}
 | 
|  |    133 | % %
 | 
|  |    134 | % \end{column}
 | 
|  |    135 | % \begin{column}{.5\textwidth}
 | 
|  |    136 | % \small{}In PEP \& CFL \medskip\\
 | 
|  |    137 | % \begin{tikzpicture}\footnotesize
 | 
|  |    138 | % \begin{axis}[
 | 
|  |    139 | %     xlabel={$n$},
 | 
|  |    140 | %     x label style={at={(1.07,0.0)}},
 | 
|  |    141 | %     ylabel={time in secs},
 | 
|  |    142 | %     enlargelimits=false,
 | 
|  |    143 | %     xtick={0,5000,...,10000},
 | 
|  |    144 | %     xmax=11000,
 | 
|  |    145 | %     ymax=35,
 | 
|  |    146 | %     ytick={0,5,...,30},
 | 
|  |    147 | %     scaled ticks=false,
 | 
|  |    148 | %     axis lines=left,
 | 
|  |    149 | %     width=\textwidth,
 | 
|  |    150 | %     height=4cm]
 | 
|  |    151 | % \addplot[green,mark=square*,mark options={fill=white}] table {re2.data};
 | 
|  |    152 | % \addplot[black,mark=square*,mark options={fill=white}] table {re3.data};
 | 
|  |    153 | % \end{axis}
 | 
|  |    154 | % \end{tikzpicture}
 | 
|  |    155 | % \begin{tikzpicture}\footnotesize
 | 
|  |    156 | % \begin{axis}[
 | 
|  |    157 | %     xlabel={$n$},
 | 
|  |    158 | %     x label style={at={(1.07,0.0)}},
 | 
|  |    159 | %     ylabel={time in secs},
 | 
|  |    160 | %     enlargelimits=false,
 | 
|  |    161 | %     ymax=35,
 | 
|  |    162 | %     ytick={0,5,...,30},
 | 
|  |    163 | %     scaled ticks=false,
 | 
|  |    164 | %     axis lines=left,
 | 
|  |    165 | %     width=\textwidth,
 | 
|  |    166 | %     height=4cm]
 | 
|  |    167 | % \addplot[black,mark=square*,mark options={fill=white}] table {re3a.data};
 | 
|  |    168 | % \end{axis}
 | 
|  |    169 | % \end{tikzpicture}
 | 
|  |    170 | % \end{column}
 | 
|  |    171 | % \end{columns}
 | 
|  |    172 | % \medskip
 | 
| 906 |    173 | 
 | 
| 921 |    174 | % \begin{textblock}{3}(-0.1,3.3)
 | 
|  |    175 | % \small\hfill\bl{\texttt{[a?]\{n\}[a]\{n\}}}:
 | 
|  |    176 | % \end{textblock}
 | 
| 906 |    177 | 
 | 
| 921 |    178 | % \begin{textblock}{3}(-0.1,8.7)  
 | 
|  |    179 | % \small\hfill\bl{\texttt{(a*)*b}}:
 | 
|  |    180 | % \end{textblock}
 | 
| 906 |    181 | 
 | 
| 921 |    182 | % \begin{textblock}{3}(0.3,13)
 | 
|  |    183 | % \small{}matching with strings
 | 
|  |    184 | % \bl{$\underbrace{\texttt{a}...\texttt{a}}_n$}  
 | 
|  |    185 | % \end{textblock}
 | 
| 906 |    186 | 
 | 
| 921 |    187 | % \end{frame} 
 | 
|  |    188 | % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%  
 | 
| 906 |    189 |     
 | 
|  |    190 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 | 
| 921 |    191 | % \begin{frame}[c,fragile]
 | 
|  |    192 | %   \frametitle{Incidents}
 | 
| 906 |    193 |     
 | 
| 921 |    194 | %   \begin{itemize}
 | 
|  |    195 | %   \item a global outage on 2 July 2019 at \textbf{Cloudflare} 
 | 
|  |    196 | %   (first one for six years)\medskip
 | 
| 906 |    197 |   
 | 
| 921 |    198 | %   \begin{center}\small\color{blue}
 | 
|  |    199 | %   \begin{verbatim}  
 | 
|  |    200 | %   (?:(?:\"|'|\]|\}|\\|\d|(?:nan|infinity|true|false|
 | 
|  |    201 | %   null|undefined|symbol|math)|\`|\-|\+)+[)]*;?((?:\s
 | 
|  |    202 | %   |-|~|!|{}|\|\||\+)*.*(?:.*=.*)))  
 | 
|  |    203 | %   \end{verbatim}
 | 
|  |    204 | %   \end{center}\bigskip\bigskip\bigskip\bigskip\bigskip\bigskip\bigskip    
 | 
| 906 |    205 |   
 | 
| 921 |    206 | %   \item on 20 July 2016 the \textbf{Stack Exchange} webpage went down
 | 
|  |    207 | %     because of an evil regular expression
 | 
| 984 |    208 | %     \here{https://stackstatus.tumblr.com/post/147710624694/outage-postmortem-july-20-2016}    
 | 
| 921 |    209 | %   \end{itemize}
 | 
| 906 |    210 |   
 | 
| 921 |    211 | %   \begin{textblock}{6}(6,7.6)
 | 
|  |    212 | %     \includegraphics[scale=0.14]{../pics/cloudflare.png}\\
 | 
|  |    213 | %     \footnotesize
 | 
|  |    214 | %     It serves more web traffic than Twitter, Amazon, Apple,
 | 
|  |    215 | %     Instagram, Bing \& Wikipedia combined.
 | 
|  |    216 | %     \here{https://blog.cloudflare.com/details-of-the-cloudflare-outage-on-july-2-2019/}
 | 
|  |    217 | %     \end{textblock}
 | 
| 906 |    218 |   
 | 
| 921 |    219 | %   \end{frame}
 | 
|  |    220 | % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%     
 | 
| 906 |    221 |     
 | 
| 921 |    222 | % %\begin{frame}[c]
 | 
|  |    223 | % %
 | 
|  |    224 | % %\frametitle{}
 | 
|  |    225 | % %\begin{mybox3}{}\it
 | 
|  |    226 | %  ``This conversation is interesting to me, and I've researched it a little bit... I also disagree with Dr. Urban on the cost/benefit of non-GC languages...[..]\\
 | 
|  |    227 | %
 | 
|  |    228 | %  But regardless, Scala is a lot slower than, say, C or Rust. To say it's not is basically wrong (imo)....[..]
 | 
|  |    229 | %  ''\\
 | 
|  |    230 | %\mbox{}\hfill-- Oliver Iliffe,  discussion this year in PEP
 | 
|  |    231 | %\end{mybox3}\pause
 | 
|  |    232 | %
 | 
|  |    233 | %\end{frame}
 | 
| 906 |    234 | 
 | 
| 921 |    235 | %\begin{frame}<1-10>
 | 
|  |    236 | %\end{frame}  
 | 
| 876 |    237 | 
 | 
|  |    238 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 | 
|  |    239 | \begin{frame}[t]
 | 
|  |    240 | \frametitle{%  
 | 
|  |    241 |   \begin{tabular}{@ {}c@ {}}
 | 
|  |    242 |   \\[-3mm]
 | 
|  |    243 |   \LARGE Compilers and \\[-1mm] 
 | 
| 989 |    244 |   \LARGE Formal Languages\\[-3mm] 
 | 
| 876 |    245 |   \end{tabular}}
 | 
|  |    246 | 
 | 
| 998 |    247 |   
 | 
| 876 |    248 | 
 | 
|  |    249 |   \normalsize
 | 
|  |    250 |   \begin{center}
 | 
|  |    251 |   \begin{tabular}{ll}
 | 
|  |    252 |   Email:  & christian.urban at kcl.ac.uk\\
 | 
| 989 |    253 |   Office Hour: & Fridays 11:30 -- 12:30\\
 | 
| 880 |    254 |   Location: & N7.07 (North Wing, Bush House)\\
 | 
| 876 |    255 |   Slides \& Progs: & KEATS\\
 | 
| 989 |    256 |   %Pollev: & \texttt{\alert{https://pollev.com/cfltutoratki576}}\\  
 | 
| 876 |    257 |   \end{tabular}
 | 
|  |    258 |   \end{center}
 | 
|  |    259 | 
 | 
|  |    260 |   \begin{center}
 | 
|  |    261 |     \begin{tikzpicture}
 | 
|  |    262 |       \node[drop shadow,fill=white,inner sep=0pt] 
 | 
|  |    263 |       {\footnotesize\rowcolors{1}{capri!10}{white}
 | 
|  |    264 |         \begin{tabular}{|p{4.8cm}|p{4.8cm}|}\hline
 | 
|  |    265 |           \cellcolor{blue!50}
 | 
|  |    266 |           1 Introduction, Languages          & 6 While-Language \\
 | 
|  |    267 |           2 Regular Expressions, Derivatives & 7 Compilation, JVM \\
 | 
|  |    268 |           3 Automata, Regular Languages      & 8 Compiling Functional Languages \\
 | 
|  |    269 |           4 Lexing, Tokenising               & 9 Optimisations \\
 | 
|  |    270 |           5 Grammars, Parsing                & 10 LLVM \\ \hline
 | 
|  |    271 |         \end{tabular}%
 | 
|  |    272 |       };
 | 
|  |    273 |     \end{tikzpicture}
 | 
|  |    274 |   \end{center}
 | 
|  |    275 | 
 | 
| 998 |    276 | 
 | 
|  |    277 |   \begin{textblock}{5}(12,3)
 | 
|  |    278 |   \includegraphics[scale=0.35]{qr01}\\
 | 
|  |    279 |   \small Wifi: IET-Guest
 | 
|  |    280 |   \end{textblock} 
 | 
| 876 |    281 | \end{frame}
 | 
|  |    282 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 | 
|  |    283 | 
 | 
|  |    284 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 | 
|  |    285 | \begin{frame}<1-12>[c]
 | 
|  |    286 | \frametitle{The Goal of this Module\ldots}
 | 
|  |    287 | 
 | 
|  |    288 | \begin{center}
 | 
|  |    289 |   \begin{tikzpicture}[scale=1,
 | 
|  |    290 |                       node/.style={
 | 
|  |    291 |                       rectangle,rounded corners=3mm,
 | 
|  |    292 |                       very thick,draw=black!50,minimum height=18mm, minimum width=20mm,
 | 
|  |    293 |                       top color=white,bottom color=black!20,drop shadow}]
 | 
|  |    294 | 
 | 
|  |    295 |   \node at (3.05, 1.8) {\Large\bf \ldots{} you write a compiler};
 | 
|  |    296 | 
 | 
|  |    297 |   \node (0) at (-2.3,0) {};  
 | 
|  |    298 |   \node [above=5mm of 0]
 | 
|  |    299 |   {\makebox[0mm]{\footnotesize
 | 
|  |    300 |       \begin{tabular}{@{}l@{}}input\\[-1mm]program\end{tabular}}}; 
 | 
|  |    301 |      
 | 
|  |    302 |   \node (A) at (0,0)  [node] {};
 | 
|  |    303 |   \node [below right] at (A.north west) {lexer};
 | 
|  |    304 | 
 | 
|  |    305 |   \node (B) at (3,0)  [node] {};
 | 
|  |    306 |   \node [below right=1mm] at (B.north west) {\mbox{}\hspace{-1mm}parser};
 | 
|  |    307 | 
 | 
|  |    308 |   \node (C) at (6,0)  [node] {};
 | 
|  |    309 |   \node [below right] at (C.north west) {\mbox{}\hspace{-1mm}code gen};
 | 
|  |    310 | 
 | 
|  |    311 |   \node (1) at (8.4,0) {};
 | 
|  |    312 |   \node [above=5mm of 1]
 | 
|  |    313 |   {\makebox[0mm]{\footnotesize
 | 
|  |    314 |       \begin{tabular}{@{}r@{}}binary\\[-1mm]code\end{tabular}}};
 | 
|  |    315 | 
 | 
| 928 |    316 |   \draw [->,line width=3mm] (0) -- (A); 
 | 
|  |    317 |   \draw [->,line width=3mm] (A) -- (B); 
 | 
|  |    318 |   \draw [->,line width=3mm] (B) -- (C); 
 | 
|  |    319 |   \draw [->,line width=3mm] (C) -- (1); 
 | 
| 876 |    320 |   \end{tikzpicture}
 | 
|  |    321 |   \end{center}
 | 
|  |    322 | 
 | 
|  |    323 | \only<2,3,4>{
 | 
|  |    324 | \begin{textblock}{1}(1,2.1)
 | 
|  |    325 | \begin{bubble}[9.8cm]
 | 
|  |    326 | \normalsize
 | 
|  |    327 | lexer input: a string\smallskip\\
 | 
|  |    328 | \hspace{5mm}\code{"read(n);"}\medskip\\
 | 
|  |    329 | lexer output: a sequence of tokens\smallskip\\
 | 
|  |    330 | \hspace{5mm}\code{key(read) lpar id(n) rpar semi}
 | 
|  |    331 | \end{bubble}
 | 
|  |    332 | \end{textblock}} 
 | 
|  |    333 | 
 | 
|  |    334 | \only<3,4>{
 | 
|  |    335 | \begin{textblock}{1}(6,7.8)
 | 
|  |    336 | \begin{tabular}{c}
 | 
|  |    337 | \includegraphics[scale=0.2]{../pics/rosetta.jpg}\\[-2mm]
 | 
|  |    338 | \footnotesize lexing $\Rightarrow$ recognising words (Stone of Rosetta)
 | 
|  |    339 | \end{tabular}
 | 
|  |    340 | \end{textblock}}
 | 
|  |    341 | 
 | 
|  |    342 | \only<4>{
 | 
|  |    343 | \begin{textblock}{1}(0.5,12)\small
 | 
|  |    344 | \begin{tabular}{l@{}c@{}l}
 | 
|  |    345 |   \pcode{if}    & $\;\Rightarrow\;$ & keyword\\
 | 
|  |    346 |   \pcode{iffoo} & $\;\Rightarrow\;$ & identifier\\
 | 
|  |    347 | \end{tabular}  
 | 
|  |    348 | \end{textblock}}
 | 
|  |    349 | 
 | 
|  |    350 | \only<6>{
 | 
|  |    351 | \begin{textblock}{1}(1,1.5)
 | 
|  |    352 | \begin{bubble}[8.5cm]
 | 
|  |    353 | \normalsize
 | 
|  |    354 | parser input: a sequence of tokens\smallskip\\
 | 
|  |    355 | 
 | 
|  |    356 | {\small\hspace{5mm}\code{key(read) lpar id(n) rpar semi}}\smallskip\\
 | 
|  |    357 | 
 | 
|  |    358 | parser output: an abstract syntax tree\smallskip\\
 | 
|  |    359 | \footnotesize
 | 
|  |    360 | \hspace{2cm}\begin{tikzpicture}
 | 
|  |    361 |   \node {\code{read}}
 | 
|  |    362 |     child {node {\code{lpar}}}
 | 
|  |    363 |     child {node {\code{n}}}
 | 
|  |    364 |     child {node {\code{rpar}}};
 | 
|  |    365 | \end{tikzpicture}
 | 
|  |    366 | \end{bubble}
 | 
|  |    367 | \end{textblock}}
 | 
|  |    368 | 
 | 
|  |    369 | \only<8,9>{
 | 
|  |    370 | \begin{textblock}{1}(1,1.5)
 | 
|  |    371 | \begin{bubble}[4cm]
 | 
|  |    372 | \normalsize
 | 
|  |    373 | code generation:\smallskip\\
 | 
|  |    374 | \hspace{5mm}\code{istore 2}\\ 
 | 
|  |    375 | \hspace{5mm}\code{iload 2}\\ 
 | 
|  |    376 | \hspace{5mm}\code{ldc 10}\\
 | 
|  |    377 | \hspace{5mm}\code{isub}\\
 | 
|  |    378 | \hspace{5mm}\code{ifeq Label2}\\ 
 | 
|  |    379 | \hspace{5mm}\code{iload 2}\\
 | 
|  |    380 | \hspace{5mm}\code{...}\\
 | 
|  |    381 | \end{bubble}
 | 
|  |    382 | \end{textblock}}
 | 
|  |    383 | 
 | 
|  |    384 | \only<9>{
 | 
|  |    385 | \begin{textblock}{6}(8.4,7)
 | 
|  |    386 | \begin{bubble}[5cm]
 | 
|  |    387 | \mbox{\begin{tikzpicture}[scale=0.58,rounded corners=0mm]
 | 
|  |    388 | \begin{axis}[axis x line=bottom, axis y line=left, ylabel=secs,
 | 
|  |    389 |     xlabel=n,
 | 
|  |    390 |     enlargelimits=0.05,
 | 
|  |    391 |     ybar interval=0.7, legend style=small]
 | 
|  |    392 | \addplot file {interpreted2.data};
 | 
|  |    393 | \addplot file {compiled2.data};
 | 
|  |    394 | %\legend{interpreted, compiled}
 | 
|  |    395 | \end{axis}
 | 
|  |    396 | \end{tikzpicture}}
 | 
|  |    397 | \end{bubble}
 | 
|  |    398 | \end{textblock}}
 | 
|  |    399 | 
 | 
|  |    400 | \only<10>{
 | 
|  |    401 | \begin{textblock}{6}(1,3)
 | 
|  |    402 |   \begin{bubble}[11cm]
 | 
|  |    403 |     Compiler explorers, e.g.: \url{https://gcc.godbolt.org} \;\video{https://youtu.be/ysaBmhMEyUg}
 | 
|  |    404 |   \begin{tikzpicture}[]
 | 
|  |    405 |   \node (0) at (-2.3,0) {\includegraphics[scale=0.3]{pics/csource.png}};
 | 
|  |    406 |   \node (1) [right=35mm] at (0) {\includegraphics[scale=0.3]{pics/cassmbl.png}}; 
 | 
|  |    407 |   \draw [->,line width=4mm, red] (0) -- (1);   
 | 
|  |    408 |   \node (2) [below=20mm] at (0) {\LARGE\bf source};
 | 
|  |    409 |   \node (3) [right=40mm] at (2) {\LARGE\bf binary};
 | 
|  |    410 |   \draw [->,line width=1mm] (2) -- (3);   
 | 
|  |    411 | \end{tikzpicture}
 | 
|  |    412 | \end{bubble}
 | 
|  |    413 | 
 | 
|  |    414 | \end{textblock}}
 | 
|  |    415 | \only<11>{
 | 
|  |    416 | \begin{textblock}{6}(1,3)
 | 
|  |    417 |   \begin{bubble}[11cm]
 | 
|  |    418 |     Compiler explorer for Java: \url{https://javap.yawk.at} 
 | 
|  |    419 |   \begin{tikzpicture}[]
 | 
|  |    420 |   \node (0) at (-2.3,0) {\includegraphics[scale=0.4]{pics/jsource.png}};
 | 
|  |    421 |   \node (1) [right=35mm] at (0) {\includegraphics[scale=0.4]{pics/jassmbl.png}}; 
 | 
|  |    422 |   \draw [->,line width=4mm, red] (0) -- (1);   
 | 
|  |    423 |   \node (2) [below=20mm] at (0) {\LARGE\bf source};
 | 
|  |    424 |   \node (3) [right=40mm] at (2) {\LARGE\bf byte code};
 | 
|  |    425 |   \draw [->,line width=1mm] (2) -- (3);   
 | 
|  |    426 | \end{tikzpicture}
 | 
|  |    427 | \end{bubble}
 | 
|  |    428 | \end{textblock}}
 | 
|  |    429 | 
 | 
|  |    430 | 
 | 
|  |    431 | \end{frame}
 | 
|  |    432 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%     
 | 
|  |    433 | 
 | 
|  |    434 | 
 | 
|  |    435 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 | 
|  |    436 | \begin{frame}[t]
 | 
|  |    437 | \frametitle{Why Study Compilers?}
 | 
|  |    438 | 
 | 
|  |    439 | 
 | 
|  |    440 | John Regehr {\small(Univ.~Utah, LLVM compiler hacker)}
 | 
|  |    441 | \here{https://blog.regehr.org/archives/1419}
 | 
|  |    442 | \smallskip\\
 | 
|  |    443 | 
 | 
|  |    444 | \begin{bubble}[10.5cm]
 | 
|  |    445 |   \bf ``\ldots{}It’s effectively a perpetual
 | 
|  |    446 |   employment act for solid compiler hackers.''
 | 
|  |    447 | \end{bubble}
 | 
|  |    448 | 
 | 
|  |    449 | \onslide<1->{
 | 
|  |    450 | \only<2>{
 | 
|  |    451 | \begin{itemize}
 | 
|  |    452 | \item {\bf Hardware is getting weirder
 | 
|  |    453 |   rather than getting clocked faster.}
 | 
|  |    454 | 
 | 
|  |    455 | \begin{itemize}
 | 
|  |    456 | \item[]  ``Almost all processors are multicores nowadays and it looks
 | 
|  |    457 |   like there is increasing asymmetry in resources across cores.
 | 
|  |    458 |   Processors come with vector units, crypto accelerators etc. We have
 | 
|  |    459 |   DSPs, GPUs, ARM big.little, and Xeon Phi. This is only scratching the
 | 
|  |    460 |   surface.''
 | 
|  |    461 | \end{itemize}  
 | 
|  |    462 | \end{itemize}}
 | 
|  |    463 | \only<3>{
 | 
|  |    464 | \begin{itemize}
 | 
|  |    465 | \item {\bf We’re getting tired of low-level languages and
 | 
|  |    466 |     their associated security disasters.}
 | 
|  |    467 |   
 | 
|  |    468 | \begin{itemize}
 | 
|  |    469 | \item [] ``We want to write new code, to whatever extent possible, in
 | 
|  |    470 |   safer, higher-level languages. Compilers are caught right in the
 | 
|  |    471 |   middle of these opposing trends: one of their main jobs is to help
 | 
|  |    472 |   bridge the large and growing gap between increasingly high-level
 | 
|  |    473 |   languages and increasingly wacky platforms.''
 | 
|  |    474 | \end{itemize}  
 | 
|  |    475 | \end{itemize}}}
 | 
|  |    476 | 
 | 
|  |    477 | \end{frame}
 | 
|  |    478 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 | 
|  |    479 | 
 | 
| 879 |    480 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 | 
| 929 |    481 | % {
 | 
|  |    482 | % \setbeamercolor{background canvas}{bg=cream}
 | 
|  |    483 | % \begin{frame}[c]
 | 
| 879 |    484 | 
 | 
| 929 |    485 | % \frametitle{}
 | 
|  |    486 | % \begin{mybox3}{}\it
 | 
|  |    487 | %    ``I enjoyed the module - it was genuinely the stand out academic
 | 
|  |    488 | % experience of my undergraduate degree, and very much influenced my
 | 
|  |    489 | % career interests. In fact I am currently working at ARM, in their Open
 | 
|  |    490 | % Source Software group, on AArch64 specific optimisations for the
 | 
|  |    491 | % Java/Kotlin compiler that forms part of the Android Runtime.''\\
 | 
|  |    492 | % \mbox{}\hfill-- Hari Limaye in year 2021/22
 | 
|  |    493 | % \end{mybox3}\pause
 | 
| 879 |    494 | 
 | 
|  |    495 | 
 | 
| 929 |    496 | % Student numbers in CFL\medskip\\
 | 
|  |    497 | % \begin{tabular}{ll}
 | 
|  |    498 | % 2019: & 32\\  
 | 
|  |    499 | % 2020: & 59\\  
 | 
|  |    500 | % 2021: & 109\\
 | 
|  |    501 | % 2022: & 121\\  
 | 
|  |    502 | % \end{tabular}  
 | 
| 879 |    503 | 
 | 
| 929 |    504 | % \end{frame}
 | 
|  |    505 | % }
 | 
| 879 |    506 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
 | 
|  |    507 | 
 | 
|  |    508 | 
 | 
|  |    509 | 
 | 
| 876 |    510 | 
 | 
|  |    511 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 | 
|  |    512 | \begin{frame}[c]
 | 
|  |    513 | \frametitle{Why Bother with Compilers?}
 | 
|  |    514 |   
 | 
|  |    515 | \textbf{Boeing 777's}: First flight in 1994. They want to achieve
 | 
|  |    516 | triple redundancy for potential hardware faults.
 | 
| 960 |    517 | \here{https://ieeexplore.ieee.org/document/495891}\bigskip
 | 
| 876 |    518 |   
 | 
|  |    519 | They compile 1 Ada program to\medskip
 | 
|  |    520 |   
 | 
|  |    521 | \begin{itemize}
 | 
|  |    522 |   \item Intel 80486
 | 
|  |    523 |   \item Motorola 68040 (old Macintosh's)
 | 
|  |    524 |   \item AMD 29050 (RISC chips used often in laser printers)
 | 
|  |    525 | \end{itemize}\medskip\medskip
 | 
|  |    526 |   
 | 
|  |    527 | using 3 independent compilers.\bigskip\pause
 | 
|  |    528 |   
 | 
|  |    529 | \small Airbus uses C and static analysers. Recently started using CompCert.
 | 
|  |    530 | 
 | 
|  |    531 | \only<1->{%
 | 
|  |    532 | \begin{textblock}{6}(8,4.5)
 | 
|  |    533 | \includegraphics[scale=0.28]{../pics/777.png}
 | 
|  |    534 | \end{textblock}}
 | 
|  |    535 | 
 | 
|  |    536 | \end{frame}
 | 
|  |    537 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 | 
|  |    538 | 
 | 
|  |    539 | 
 | 
|  |    540 | 
 | 
|  |    541 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 | 
|  |    542 | \begin{frame}[c]
 | 
|  |    543 | \frametitle{What Do Compilers Do?}
 | 
|  |    544 | 
 | 
|  |    545 | Remember BF*** from PEP?
 | 
|  |    546 | 
 | 
|  |    547 | \begin{center}
 | 
|  |    548 | \begin{tabular}{rcl}
 | 
|  |    549 | \bl{\texttt{>}} & $\Rightarrow$ & move one cell right\\
 | 
|  |    550 | \bl{\texttt{<}} & $\Rightarrow$ & move one cell left\\
 | 
|  |    551 | \bl{\texttt{+}} & $\Rightarrow$ & increase cell by one\\
 | 
|  |    552 | \bl{\texttt{-}} & $\Rightarrow$ & decrease cell by one\\
 | 
|  |    553 | \bl{\texttt{.}} & $\Rightarrow$ & print current cell\\
 | 
|  |    554 | \bl{\texttt{,}} & $\Rightarrow$ & input current cell\\
 | 
|  |    555 | \bl{\texttt{[}} & $\Rightarrow$ & loop begin\\
 | 
|  |    556 | \bl{\texttt{]}} & $\Rightarrow$ & loop end\medskip\\
 | 
|  |    557 |                 & $\Rightarrow$ & everything else is a comment\\
 | 
|  |    558 | \end{tabular}  
 | 
|  |    559 | \end{center}  
 | 
|  |    560 | 
 | 
|  |    561 | \end{frame}
 | 
|  |    562 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
 | 
|  |    563 | 
 | 
|  |    564 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 | 
|  |    565 | \begin{frame}[c]
 | 
|  |    566 |   \frametitle{A ``Compiler'' for BF*** to C}
 | 
|  |    567 |   
 | 
|  |    568 |   \begin{center}
 | 
|  |    569 |   \begin{tabular}{rcl}
 | 
|  |    570 |   \bl{\texttt{>}} & $\Rightarrow$ & \texttt{ptr++}\\
 | 
|  |    571 |   \bl{\texttt{<}} & $\Rightarrow$ & \texttt{ptr--}\\
 | 
|  |    572 |   \bl{\texttt{+}} & $\Rightarrow$ & \texttt{(*ptr)++}\\
 | 
|  |    573 |   \bl{\texttt{-}} & $\Rightarrow$ & \texttt{(*ptr)--}\\
 | 
|  |    574 |   \bl{\texttt{.}} & $\Rightarrow$ & \texttt{putchar(*ptr)}\\
 | 
|  |    575 |   \bl{\texttt{,}} & $\Rightarrow$ & \texttt{*ptr = getchar()}\\
 | 
|  |    576 |   \bl{\texttt{[}} & $\Rightarrow$ & \texttt{while(*ptr)\{}\\
 | 
|  |    577 |   \bl{\texttt{]}} & $\Rightarrow$ & \texttt{\}}\medskip\\
 | 
|  |    578 |                   & $\Rightarrow$ & ignore everything else\\
 | 
|  |    579 |   \end{tabular}  
 | 
|  |    580 |   \end{center}\bigskip  
 | 
|  |    581 |   
 | 
|  |    582 |   \texttt{char field[30000]\\ char *ptr = \&field[15000]}
 | 
|  |    583 |   
 | 
|  |    584 | \end{frame}
 | 
|  |    585 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 | 
|  |    586 | 
 | 
|  |    587 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 | 
|  |    588 | \begin{frame}[c]
 | 
|  |    589 |   \frametitle{Another~``Compiler''~for~BF~to~C}
 | 
|  |    590 |   
 | 
|  |    591 |   \begin{center}
 | 
|  |    592 |   \begin{tabular}{rcl}
 | 
|  |    593 |   \bl{\texttt{>\ldots>}} & $\Rightarrow$ & \texttt{ptr += n}\\
 | 
|  |    594 |   \bl{\texttt{<\ldots<}} & $\Rightarrow$ & \texttt{ptr -= n}\\
 | 
|  |    595 |   \bl{\texttt{+\ldots+}} & $\Rightarrow$ & \texttt{(*ptr) += n}\\
 | 
|  |    596 |   \bl{\texttt{-\ldots-}} & $\Rightarrow$ & \texttt{(*ptr) -= n}\\
 | 
|  |    597 |   \bl{\texttt{.}} & $\Rightarrow$ & \texttt{putchar(*ptr)}\\
 | 
|  |    598 |   \bl{\texttt{,}} & $\Rightarrow$ & \texttt{*ptr = getchar()}\\
 | 
|  |    599 |   \bl{\texttt{[}} & $\Rightarrow$ & \texttt{while(*ptr)\{}\\
 | 
|  |    600 |   \bl{\texttt{]}} & $\Rightarrow$ & \texttt{\}}\medskip\\
 | 
|  |    601 |                   & $\Rightarrow$ & ignore everything else\\
 | 
|  |    602 |   \end{tabular}  
 | 
|  |    603 |   \end{center}\bigskip  
 | 
|  |    604 |   
 | 
|  |    605 |   \texttt{char field[30000]\\ char *ptr = \&field[15000]}
 | 
|  |    606 |   
 | 
|  |    607 | \end{frame}
 | 
|  |    608 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
 | 
|  |    609 |     
 | 
|  |    610 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 | 
|  |    611 | \begin{frame}[t]
 | 
|  |    612 | \frametitle{A Brief Compiler History}
 | 
|  |    613 | 
 | 
|  |    614 | \bigskip
 | 
|  |    615 | \begin{itemize}
 | 
|  |    616 | \item Turing Machines, 1936 (a tape as memory)
 | 
|  |    617 | \item Regular Expressions, 1956\\
 | 
|  |    618 | \item The first compiler for COBOL, 1957\\ (Grace Hopper)\medskip
 | 
|  |    619 | \item But surprisingly research papers are still published nowadays\\
 | 
|  |    620 | \item ``Parsing: The Solved Problem That Isn't''
 | 
|  |    621 |   \here{https://tratt.net/laurie/blog/entries/parsing_the_solved_problem_that_isnt.html}
 | 
|  |    622 | \end{itemize}
 | 
|  |    623 | 
 | 
|  |    624 | 
 | 
|  |    625 | \begin{textblock}{8.5}(5,7.6)
 | 
|  |    626 | \begin{flushright}
 | 
|  |    627 | \includegraphics[scale=0.3]{pics/hopper.jpg}\\
 | 
|  |    628 | \footnotesize\textcolor{gray}{Grace Hopper}\smallskip\\
 | 
|  |    629 | 
 | 
|  |    630 | {\small\textcolor{gray}{(she made it to David Letterman's Tonight Show
 | 
| 964 |    631 |     \here{https://youtu.be/oE2uls6iIEU})}}
 | 
| 876 |    632 | \end{flushright}
 | 
|  |    633 | \end{textblock}
 | 
|  |    634 | 
 | 
|  |    635 | \end{frame}
 | 
|  |    636 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%     
 | 
|  |    637 | 
 | 
|  |    638 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 | 
| 964 |    639 | {\setbeamercolor{background canvas}{bg=cream}
 | 
| 876 |    640 | \begin{frame}[c]
 | 
| 989 |    641 | \frametitle{How to study for CFL?}
 | 
|  |    642 | 
 | 
|  |    643 | My recommendation for each week: 
 | 
|  |    644 | 
 | 
|  |    645 | \begin{itemize}
 | 
|  |    646 | \item read the handout
 | 
|  |    647 | \item watch the videos
 | 
|  |    648 | \item re-read the handout
 | 
|  |    649 | \item do the HW to be discussed at the SGT
 | 
| 996 |    650 | \item \textcolor{red}{play with the uploaded code}
 | 
| 989 |    651 | \item later on do the CW
 | 
|  |    652 | \end{itemize}
 | 
|  |    653 | 
 | 
|  |    654 | 
 | 
|  |    655 | \end{frame}}
 | 
|  |    656 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
 | 
|  |    657 | 
 | 
|  |    658 | 
 | 
|  |    659 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 | 
|  |    660 | {\setbeamercolor{background canvas}{bg=cream}
 | 
|  |    661 | \begin{frame}[c]
 | 
| 876 |    662 | \frametitle{Some Housekeeping}
 | 
|  |    663 | 
 | 
| 929 |    664 | \textbf{Exam will be computer-based, invigilated in some big examination hall:}\bigskip
 | 
| 876 |    665 | 
 | 
|  |    666 | \begin{itemize}
 | 
| 989 |    667 | \item final exam in January (\textbf{40\%})
 | 
|  |    668 | \item coursework (\textbf{60\%- the first part is optional}) 
 | 
| 876 |    669 | \end{itemize}\bigskip\bigskip\pause
 | 
|  |    670 | 
 | 
|  |    671 | 
 | 
|  |    672 | \textbf{Weekly Homework (optional):}
 | 
|  |    673 | \begin{itemize}
 | 
| 960 |    674 | \item uploaded on KEATS - solutions will be discussed during the SGTs
 | 
| 964 |    675 | \item \alert{\bf all} questions in the exam will be in some close shape or form from the HWs!!
 | 
| 876 |    676 | \end{itemize}  
 | 
|  |    677 | 
 | 
| 964 |    678 | \end{frame}}
 | 
|  |    679 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
 | 
|  |    680 | 
 | 
|  |    681 | 
 | 
|  |    682 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
 | 
|  |    683 | {
 | 
|  |    684 | \setbeamercolor{background canvas}{bg=cream}
 | 
|  |    685 | \begin{frame}[c]
 | 
|  |    686 | \frametitle{Homework}
 | 
|  |    687 | 
 | 
|  |    688 | Until 3 years ago: I did not give out solutions; students
 | 
|  |    689 | sent emails to me and I responded to them individually.\bigskip\\
 | 
|  |    690 | 
 | 
| 989 |    691 | Now: TAs will review the homework mainly during the SGTs.\bigskip\\\pause
 | 
| 964 |    692 | 
 | 
|  |    693 | Do not harass your TAs for the solutions!
 | 
|  |    694 | 
 | 
| 876 |    695 | \end{frame}
 | 
| 964 |    696 | }
 | 
| 876 |    697 | 
 | 
| 879 |    698 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
 | 
| 929 |    699 | {\definecolor{rred}{HTML}{C0504D}
 | 
|  |    700 | \setbeamercolor{background canvas}{bg=cream}
 | 
|  |    701 | \begin{frame}[c]
 | 
|  |    702 | \frametitle{Students in CFL}
 | 
|  |    703 | 
 | 
|  |    704 | \begin{center}
 | 
|  |    705 | \begin{tikzpicture}
 | 
| 989 |    706 |   \begin{axis}[symbolic x coords={2016,2017,2018,2019,2020,2021,2022,2023,2024,2025},
 | 
|  |    707 |     width  = 1.2\textwidth,
 | 
| 929 |    708 |     height = 5cm,
 | 
|  |    709 |     bar width=8mm,
 | 
|  |    710 |     nodes near coords,
 | 
|  |    711 |     axis lines = left,
 | 
|  |    712 |     text=black,
 | 
|  |    713 |     ymin=0,
 | 
|  |    714 |     clip=false,
 | 
|  |    715 |     hide y axis,
 | 
|  |    716 |     axis line style={-},
 | 
|  |    717 |     name=mygraph
 | 
|  |    718 |     ]
 | 
| 964 |    719 | 
 | 
|  |    720 | \only<1>{\addplot[ybar,style={rred,fill=rred!75,mark=none},text=black] coordinates {
 | 
| 989 |    721 | (2025,181)
 | 
| 964 |    722 | (2024,173)
 | 
|  |    723 | (2023,169)
 | 
|  |    724 | (2022,111)
 | 
|  |    725 | (2021,98)
 | 
|  |    726 | (2020,59)
 | 
|  |    727 | (2019,38)
 | 
|  |    728 | (2018,20)
 | 
|  |    729 | (2017,22)
 | 
|  |    730 | (2016,8)}};
 | 
| 929 |    731 | \end{axis}
 | 
|  |    732 | \node[anchor=north, yshift=-10mm] at (mygraph.south) {\small{}Student numbers since the start of the compiler module.};
 | 
|  |    733 | 
 | 
|  |    734 | \end{tikzpicture}
 | 
|  |    735 | \end{center}
 | 
|  |    736 | 
 | 
|  |    737 | 
 | 
|  |    738 | \end{frame}
 | 
|  |    739 | }
 | 
|  |    740 | 
 | 
| 964 |    741 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 | 
| 879 |    742 | {
 | 
|  |    743 | \setbeamercolor{background canvas}{bg=cream}
 | 
|  |    744 | \begin{frame}[c]
 | 
| 876 |    745 | \frametitle{Some Housekeeping}
 | 
|  |    746 | 
 | 
| 989 |    747 | \textbf{Coursework (4 parts accounting for 60\%; submission deadline \underline{5th January 2026}):}\bigskip
 | 
| 876 |    748 | 
 | 
|  |    749 | \begin{itemize}
 | 
| 989 |    750 | \item matcher \xout{(5\%)}\;\;\textcolor{red}{optional}
 | 
| 876 |    751 | \item lexer (10\%)
 | 
| 989 |    752 | \item parser / interpreter (15\%)
 | 
| 876 |    753 | \item JVM compiler (15\%)
 | 
| 989 |    754 | \item LLVM compiler (20\%) 
 | 
|  |    755 | \end{itemize}
 | 
| 876 |    756 | \end{frame}
 | 
| 964 |    757 | }
 | 
|  |    758 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 | 
|  |    759 | {
 | 
|  |    760 | \setbeamercolor{background canvas}{bg=cream}
 | 
| 989 |    761 | \begin{frame}[c]
 | 
|  |    762 | \frametitle{Some Housekeeping}
 | 
|  |    763 | 
 | 
|  |    764 | \begin{itemize}
 | 
|  |    765 | \item you can use any code I show you and is uploaded to KEATS; therefore 
 | 
|  |    766 |   most students use Scala/Ammonite
 | 
|  |    767 | \item but you can use \alert{any} programming language you like (Haskell, Rust, Swift\ldots you have to show me how to run your code)
 | 
|  |    768 | \pause
 | 
|  |    769 | \item \textcolor{red}{\textbf{you can even use AI for CW}}\pause\bigskip 
 | 
|  |    770 | \item \textbf{BUT YOU CANNOT COPY FROM OR COLLABORATE WITH OTHER STUDENTS!}
 | 
|  |    771 | \end{itemize}
 | 
|  |    772 | \end{frame}
 | 
| 964 |    773 | }
 | 
|  |    774 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 | 
| 989 |    775 | %{
 | 
|  |    776 | %\setbeamercolor{background canvas}{bg=cream}
 | 
|  |    777 | %\begin{frame}[c,fragile]
 | 
|  |    778 | %\end{frame}  
 | 
|  |    779 | %}
 | 
|  |    780 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 | 
| 964 |    781 | {
 | 
|  |    782 | \setbeamercolor{background canvas}{bg=cream}
 | 
|  |    783 | \begin{frame}[c,fragile]
 | 
|  |    784 | %%\frametitle{Scala 3}
 | 
| 876 |    785 | 
 | 
| 989 |    786 | I will show you all my code in Scala 3\bigskip
 | 
| 964 |    787 | 
 | 
|  |    788 | \begin{minipage}{1.4\textwidth}
 | 
|  |    789 | \begin{lstlisting}[language={},numbers=none,basicstyle=\ttfamily\small]
 | 
| 989 |    790 | $ scala
 | 
|  |    791 | Welcome to Scala 3.7.3 (21.0.8, Java OpenJDK 64-Bit Server VM).
 | 
| 964 |    792 | Type in expressions for evaluation. Or try :help.
 | 
|  |    793 | 
 | 
|  |    794 | scala> 1 + 2
 | 
|  |    795 | res0: Int = 3
 | 
|  |    796 | \end{lstlisting} %% $
 | 
|  |    797 | \end{minipage}\medskip
 | 
|  |    798 | \pause
 | 
|  |    799 | 
 | 
| 989 |    800 | %Since Scala 3.5.0, scala-cli is included in "plain" Scala
 | 
|  |    801 | %
 | 
|  |    802 | %\begin{minipage}{1.4\textwidth}
 | 
|  |    803 | %\begin{lstlisting}[language={},numbers=none,basicstyle=\ttfamily\small]
 | 
|  |    804 | %$ scala
 | 
|  |    805 | %Welcome to Scala 3.5.1 (21.0.4, Java OpenJDK 64-Bit Server VM).
 | 
|  |    806 | %Type in expressions for evaluation. Or try :help.
 | 
|  |    807 | %
 | 
|  |    808 | %scala> 
 | 
|  |    809 | %\end{lstlisting} %% $
 | 
|  |    810 | %\end{minipage}
 | 
| 964 |    811 | \end{frame}
 | 
|  |    812 | }
 | 
|  |    813 | 
 | 
|  |    814 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
 | 
| 929 |    815 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
 | 
|  |    816 | {
 | 
|  |    817 | \setbeamercolor{background canvas}{bg=cream}
 | 
|  |    818 | \begin{frame}[c,fragile]
 | 
|  |    819 | \frametitle{Ammonite \& Scala 3}
 | 
|  |    820 | 
 | 
| 964 |    821 | Actually in CFL, I will use Amm / Scala 3
 | 
| 929 |    822 | 
 | 
|  |    823 | \begin{minipage}{1.4\textwidth}
 | 
|  |    824 | \begin{lstlisting}[language={},numbers=none,basicstyle=\ttfamily\small]
 | 
|  |    825 | $ amm
 | 
|  |    826 | Loading...
 | 
| 989 |    827 | Welcome to the Ammonite Repl 3.0.2 (Scala 3.3.5 Java 21.0.8)
 | 
|  |    828 | @ 1 + 2
 | 
| 929 |    829 | res0: Int = 3
 | 
|  |    830 | \end{lstlisting} %% $
 | 
|  |    831 | \end{minipage}\medskip
 | 
|  |    832 | \pause
 | 
|  |    833 | 
 | 
| 989 |    834 | Do not use Amm + Scala 2! Do not use sbt!
 | 
| 929 |    835 | 
 | 
|  |    836 | \begin{minipage}{1.4\textwidth}
 | 
|  |    837 | \begin{lstlisting}[language={},numbers=none,basicstyle=\ttfamily\small]
 | 
|  |    838 | $ amm2
 | 
|  |    839 | Loading...
 | 
|  |    840 | Welcome to the Ammonite Repl 2.5.9 (Scala 2.13.11 Java 17.0.7)
 | 
| 989 |    841 | @ 
 | 
| 929 |    842 | \end{lstlisting} %% $
 | 
|  |    843 | \end{minipage}
 | 
|  |    844 | \end{frame}
 | 
|  |    845 | }
 | 
|  |    846 | 
 | 
|  |    847 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
 | 
|  |    848 | {
 | 
|  |    849 | \setbeamercolor{background canvas}{bg=cream}
 | 
|  |    850 | \begin{frame}[c]
 | 
| 997 |    851 | \frametitle{For Install and GitHub Problems}
 | 
| 989 |    852 |  
 | 
| 929 |    853 | \begin{itemize}
 | 
| 989 |    854 | \item Flavio Melinte Citea\\ (flavio.melinte\_citea@kcl.ac.uk)\bigskip \\
 | 
|  |    855 | \item Zishan Rahman\\ (zishan.rahman@kcl.ac.uk) 
 | 
| 929 |    856 | \end{itemize}
 | 
|  |    857 |   
 | 
|  |    858 | \end{frame}
 | 
|  |    859 | }
 | 
|  |    860 | 
 | 
| 930 |    861 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
 | 
|  |    862 | {
 | 
|  |    863 | \setbeamercolor{background canvas}{bg=cream}
 | 
|  |    864 | \begin{frame}[c]
 | 
|  |    865 | 
 | 
|  |    866 | \begin{minipage}{1.3\textwidth}
 | 
|  |    867 | \begin{mybox3}{}\it\small
 | 
|  |    868 | Unequivocally the worst module I've taken on this course. The subject
 | 
|  |    869 | matter is fascinating, however the insistence on the use of this
 | 
|  |    870 | abomination of a language "Scala" completely ruins it. If you're going
 | 
|  |    871 | to teach something as complex as this, use a proper language, not some
 | 
|  |    872 | "object oriented functional" abomination. Use C, you know, the
 | 
|  |    873 | language that real compilers are written in. I will go to the end of
 | 
|  |    874 | the earth to dissuade others from taking this module so long as Scala
 | 
|  |    875 | is still being used.\\
 | 
|  |    876 | \mbox{}\hfill-- Lone voice in the end-of-year feedback in 2019
 | 
|  |    877 | \end{mybox3}
 | 
|  |    878 | \end{minipage}\bigskip
 | 
|  |    879 | 
 | 
|  |    880 | \small (for alternative opinions check ``What the students say'' on KEATS)
 | 
|  |    881 |   
 | 
|  |    882 | \end{frame}
 | 
|  |    883 | }
 | 
|  |    884 | 
 | 
|  |    885 | 
 | 
| 929 |    886 | 
 | 
| 876 |    887 | 
 | 
|  |    888 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 | 
|  |    889 | \begin{frame}[c]
 | 
|  |    890 | \frametitle{Lectures 1 - 5}
 | 
|  |    891 | 
 | 
|  |    892 | transforming strings into structured data\\[10mm]
 | 
|  |    893 | 
 | 
|  |    894 | {\LARGE\bf Lexing} {\hfill{}based on regular expressions}\medskip\\
 | 
|  |    895 | \hspace{5mm}(recognising ``words'')\\[6mm]
 | 
|  |    896 | 
 | 
|  |    897 | {\LARGE\bf Parsing}\medskip\\
 | 
|  |    898 | \hspace{5mm}(recognising ``sentences'')
 | 
|  |    899 | 
 | 
|  |    900 | \begin{textblock}{1}(10,9.1)
 | 
|  |    901 | \begin{tabular}{c}
 | 
|  |    902 | \includegraphics[scale=0.1]{../pics/rosetta.jpg}\\[-2mm]
 | 
|  |    903 | \footnotesize Stone of Rosetta
 | 
|  |    904 | \end{tabular}
 | 
|  |    905 | \end{textblock}
 | 
|  |    906 | 
 | 
|  |    907 | \end{frame}
 | 
|  |    908 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
 | 
|  |    909 | 
 | 
|  |    910 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 | 
|  |    911 | \begin{frame}[c]
 | 
|  |    912 | \frametitle{Lectures 1 - 5}
 | 
|  |    913 | 
 | 
|  |    914 | transforming strings into structured data\\[10mm]
 | 
|  |    915 | 
 | 
|  |    916 | {\LARGE\bf Lexing} {\hfill{}based on regular expressions}\medskip\\
 | 
|  |    917 | \hspace{5mm}(recognising ``words'')\\[6mm]
 | 
|  |    918 | 
 | 
|  |    919 | {\LARGE\bf Parsing}\medskip\\
 | 
|  |    920 | \hspace{5mm}(recognising ``sentences'')
 | 
|  |    921 | 
 | 
|  |    922 | \begin{textblock}{1}(10,9.1)
 | 
|  |    923 | \begin{tabular}{c}
 | 
|  |    924 | \includegraphics[scale=0.1]{../pics/rosetta.jpg}\\[-2mm]
 | 
|  |    925 | \footnotesize Stone of Rosetta
 | 
|  |    926 | \end{tabular}
 | 
|  |    927 | \end{textblock}
 | 
|  |    928 | 
 | 
|  |    929 | \end{frame}
 | 
|  |    930 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
 | 
|  |    931 | 
 | 
|  |    932 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 | 
|  |    933 | \begin{frame}[c]
 | 
|  |    934 |   \frametitle{Lectures 5 - 10}
 | 
|  |    935 |   
 | 
|  |    936 |   code generation for a small imperative and a small functional language\\[10mm]
 | 
|  |    937 |   
 | 
|  |    938 |   {\LARGE\bf Interpreters}\medskip\\
 | 
|  |    939 |   \hspace{5mm}(directly runs a program)\\[6mm]
 | 
|  |    940 |   
 | 
|  |    941 |   {\LARGE\bf Compilers}\medskip\\
 | 
|  |    942 |   \hspace{5mm}(generate JVM code and LLVM-IR code)
 | 
|  |    943 |   
 | 
|  |    944 |   \begin{textblock}{1}(8.8,8.1)
 | 
|  |    945 |   \begin{tabular}{c@{}c}
 | 
|  |    946 |     \includegraphics[scale=0.4]{../pics/javaduke.png} &
 | 
|  |    947 |     \includegraphics[scale=0.23]{../pics/llvmlogo.png}
 | 
|  |    948 |   \end{tabular}
 | 
|  |    949 |   \end{textblock}
 | 
|  |    950 |   
 | 
|  |    951 |   \end{frame}
 | 
|  |    952 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
 | 
|  |    953 |   
 | 
|  |    954 | 
 | 
|  |    955 | 
 | 
|  |    956 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 | 
|  |    957 | \begin{frame}[t]
 | 
|  |    958 | \frametitle{Familiar Regular Expresssions}
 | 
|  |    959 | \small
 | 
|  |    960 | \begin{center}
 | 
|  |    961 | \texttt{[a-z0-9\_$\backslash{}$.-]+ @ [a-z0-9$\backslash{}$.-]+ . [a-z$\backslash{}$.]\{2,6\}}
 | 
|  |    962 | \end{center}\smallskip
 | 
|  |    963 | 
 | 
|  |    964 | \begin{center}
 | 
|  |    965 | \begin{tabular}{@{}lp{8.5cm}@{}}
 | 
|  |    966 | \pcode{re*} & matches 0 or more times\\
 | 
|  |    967 | \pcode{re+} & matches 1 or more times\\
 | 
|  |    968 | \pcode{re?} & matches 0 or 1 times\\
 | 
|  |    969 | \pcode{re\{n\}}	& matches exactly \pcode{n} number of times\\
 | 
|  |    970 | \pcode{re\{n,m\}} & matches at least \pcode{n} and at most {\tt m} times\\
 | 
|  |    971 | \pcode{[...]} & matches any single character inside the brackets\\
 | 
|  |    972 | \pcode{[^...]} & matches any single character not inside the 
 | 
|  |    973 | brackets\\
 | 
|  |    974 | \pcode{a-z A-Z} & character ranges\\
 | 
|  |    975 | \pcode{\\d} & matches digits; equivalent to \pcode{[0-9]}\\
 | 
|  |    976 | \pcode{.} & matches every character except newline\\
 | 
|  |    977 | \pcode{(re)}	& groups regular expressions and remembers 
 | 
|  |    978 | the matched text
 | 
|  |    979 | \end{tabular}
 | 
|  |    980 | \end{center}
 | 
|  |    981 | 
 | 
|  |    982 | \end{frame}
 | 
|  |    983 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
 | 
| 879 |    984 | {
 | 
|  |    985 | \setbeamercolor{background canvas}{bg=cream}
 | 
|  |    986 | \begin{frame}[t]
 | 
|  |    987 | \frametitle{Notation for REs}
 | 
|  |    988 |   
 | 
|  |    989 | \end{frame}  
 | 
|  |    990 | }
 | 
| 876 |    991 | 
 | 
| 930 |    992 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
 | 
|  |    993 | {
 | 
|  |    994 | \setbeamercolor{background canvas}{bg=cream}
 | 
|  |    995 | \begin{frame}[t]
 | 
|  |    996 |   
 | 
|  |    997 | \end{frame}  
 | 
|  |    998 | }
 | 
|  |    999 | 
 | 
|  |   1000 | 
 | 
|  |   1001 | 
 | 
| 876 |   1002 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 | 
|  |   1003 | \begin{frame}[c]
 | 
|  |   1004 | \frametitle{Some ``innocent'' examples}
 | 
|  |   1005 | 
 | 
|  |   1006 | Let's try two examples
 | 
|  |   1007 | 
 | 
|  |   1008 | \begin{center}
 | 
|  |   1009 |   \bl{\texttt{(a*)*b}}
 | 
|  |   1010 |   \hspace{2cm}
 | 
|  |   1011 |   \bl{\texttt{[a?]\{n\}[a]\{n\}}}
 | 
|  |   1012 | \end{center}\bigskip\pause  
 | 
|  |   1013 | 
 | 
|  |   1014 | and match them with strings of the form
 | 
|  |   1015 | 
 | 
|  |   1016 | \begin{center}
 | 
|  |   1017 |   \bl{\texttt{a}},
 | 
|  |   1018 |   \bl{\texttt{aa}},
 | 
|  |   1019 |   \bl{\texttt{aaa}},
 | 
|  |   1020 |   \bl{\texttt{aaaa}},
 | 
|  |   1021 |   \bl{\texttt{aaaaa}},
 | 
|  |   1022 |   \bl{$\underbrace{\texttt{a}...\texttt{a}}_n$}  
 | 
|  |   1023 | \end{center}  
 | 
|  |   1024 | 
 | 
|  |   1025 | \end{frame}
 | 
|  |   1026 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
 | 
|  |   1027 | 
 | 
|  |   1028 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 | 
|  |   1029 | \begin{frame}[c]
 | 
|  |   1030 | \frametitle{Why Bother with Regexes?}
 | 
|  |   1031 | 
 | 
|  |   1032 | \begin{columns}[t,onlytextwidth]
 | 
|  |   1033 | \begin{column}{1.8cm}
 | 
|  |   1034 | \mbox{}   
 | 
|  |   1035 | \end{column}    
 | 
|  |   1036 | \begin{column}{.5\textwidth}
 | 
|  |   1037 | \small{}Ruby, Python, Java 8\medskip\\
 | 
|  |   1038 | \begin{tikzpicture}\footnotesize
 | 
|  |   1039 | \begin{axis}[
 | 
|  |   1040 |     xlabel={$n$},
 | 
|  |   1041 |     x label style={at={(1.05,0.0)}},
 | 
|  |   1042 |     ylabel={time in secs},
 | 
|  |   1043 |     enlargelimits=false,
 | 
|  |   1044 |     xtick={0,5,...,30},
 | 
|  |   1045 |     xmax=33,
 | 
|  |   1046 |     ymax=35,
 | 
|  |   1047 |     ytick={0,5,...,30},
 | 
|  |   1048 |     scaled ticks=false,
 | 
|  |   1049 |     axis lines=left,
 | 
|  |   1050 |     width=\textwidth,
 | 
|  |   1051 |     height=4cm, 
 | 
|  |   1052 |     legend entries={Python,Ruby},  
 | 
|  |   1053 |     legend pos=north west,
 | 
|  |   1054 |     legend cell align=left]
 | 
|  |   1055 | \addplot[blue,mark=*, mark options={fill=white}] table {re-python.data};
 | 
|  |   1056 | \addplot[brown,mark=triangle*, mark options={fill=white}] table {re-ruby.data};
 | 
|  |   1057 | \end{axis}
 | 
|  |   1058 | \end{tikzpicture}
 | 
|  |   1059 | \begin{tikzpicture}\footnotesize
 | 
|  |   1060 | \begin{axis}[
 | 
|  |   1061 |     xlabel={$n$},
 | 
|  |   1062 |     x label style={at={(1.05,0.0)}},
 | 
|  |   1063 |     ylabel={time in secs},
 | 
|  |   1064 |     enlargelimits=false,
 | 
|  |   1065 |     xtick={0,5,...,30},
 | 
|  |   1066 |     xmax=33,
 | 
|  |   1067 |     ymax=35,
 | 
|  |   1068 |     ytick={0,5,...,30},
 | 
|  |   1069 |     scaled ticks=false,
 | 
|  |   1070 |     axis lines=left,
 | 
|  |   1071 |     width=\textwidth,
 | 
|  |   1072 |     height=4cm, 
 | 
|  |   1073 |     legend entries={Python, Java 8, JavaScript, Swift},  
 | 
|  |   1074 |     legend pos=north west,
 | 
|  |   1075 |     legend cell align=left]
 | 
|  |   1076 | \addplot[blue,mark=*, mark options={fill=white}] table {re-python2.data};   
 | 
|  |   1077 | \addplot[cyan,mark=*, mark options={fill=white}] table {re-java.data};
 | 
|  |   1078 | \addplot[red,mark=*, mark options={fill=white}] table {re-js.data};
 | 
|  |   1079 | \addplot[magenta,mark=*, mark options={fill=white}] table {re-swift.data};
 | 
|  |   1080 | \end{axis}
 | 
|  |   1081 | \end{tikzpicture}
 | 
|  |   1082 | %
 | 
|  |   1083 | \end{column}
 | 
|  |   1084 | \begin{column}{.5\textwidth}
 | 
|  |   1085 | \small{}Us (after next lecture)\medskip\\
 | 
|  |   1086 | \begin{tikzpicture}\footnotesize
 | 
|  |   1087 | \begin{axis}[
 | 
|  |   1088 |     xlabel={$n$},
 | 
|  |   1089 |     x label style={at={(1.07,0.0)}},
 | 
|  |   1090 |     ylabel={time in secs},
 | 
|  |   1091 |     enlargelimits=false,
 | 
|  |   1092 |     xtick={0,5000,...,10000},
 | 
|  |   1093 |     xmax=11000,
 | 
|  |   1094 |     ymax=35,
 | 
|  |   1095 |     ytick={0,5,...,30},
 | 
|  |   1096 |     scaled ticks=false,
 | 
|  |   1097 |     axis lines=left,
 | 
|  |   1098 |     width=\textwidth,
 | 
|  |   1099 |     height=4cm]
 | 
|  |   1100 | \addplot[green,mark=square*,mark options={fill=white}] table {re2.data};
 | 
|  |   1101 | \addplot[black,mark=square*,mark options={fill=white}] table {re3.data};
 | 
|  |   1102 | \end{axis}
 | 
|  |   1103 | \end{tikzpicture}
 | 
|  |   1104 | \begin{tikzpicture}\footnotesize
 | 
|  |   1105 | \begin{axis}[
 | 
|  |   1106 |     xlabel={$n$},
 | 
|  |   1107 |     x label style={at={(1.07,0.0)}},
 | 
|  |   1108 |     ylabel={time in secs},
 | 
|  |   1109 |     enlargelimits=false,
 | 
|  |   1110 |     ymax=35,
 | 
|  |   1111 |     ytick={0,5,...,30},
 | 
|  |   1112 |     scaled ticks=false,
 | 
|  |   1113 |     axis lines=left,
 | 
|  |   1114 |     width=\textwidth,
 | 
|  |   1115 |     height=4cm]
 | 
|  |   1116 | \addplot[black,mark=square*,mark options={fill=white}] table {re3a.data};
 | 
|  |   1117 | \end{axis}
 | 
|  |   1118 | \end{tikzpicture}
 | 
|  |   1119 | \end{column}
 | 
|  |   1120 | \end{columns}
 | 
|  |   1121 | \medskip
 | 
|  |   1122 | 
 | 
|  |   1123 | \begin{textblock}{3}(-0.1,3.3)
 | 
|  |   1124 | \small\hfill\bl{\texttt{[a?]\{n\}[a]\{n\}}}:
 | 
|  |   1125 | \end{textblock}
 | 
|  |   1126 | 
 | 
|  |   1127 | \begin{textblock}{3}(-0.1,8.7)  
 | 
|  |   1128 | \small\hfill\bl{\texttt{(a*)*b}}:
 | 
|  |   1129 | \end{textblock}
 | 
|  |   1130 | 
 | 
|  |   1131 | \begin{textblock}{3}(0.3,13)
 | 
|  |   1132 | \small{}matching with strings
 | 
|  |   1133 | \bl{$\underbrace{\texttt{a}...\texttt{a}}_n$}  
 | 
|  |   1134 | \end{textblock}
 | 
|  |   1135 | 
 | 
|  |   1136 | \end{frame} 
 | 
|  |   1137 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%  
 | 
|  |   1138 |     
 | 
|  |   1139 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 | 
|  |   1140 | \begin{frame}[c,fragile]
 | 
|  |   1141 |   \frametitle{Incidents}
 | 
|  |   1142 |     
 | 
|  |   1143 |   \begin{itemize}
 | 
|  |   1144 |   \item a global outage on 2 July 2019 at \textbf{Cloudflare} 
 | 
|  |   1145 |   (first one for six years)\medskip
 | 
|  |   1146 |   
 | 
|  |   1147 |   \begin{center}\small\color{blue}
 | 
|  |   1148 |   \begin{verbatim}  
 | 
|  |   1149 |   (?:(?:\"|'|\]|\}|\\|\d|(?:nan|infinity|true|false|
 | 
|  |   1150 |   null|undefined|symbol|math)|\`|\-|\+)+[)]*;?((?:\s
 | 
|  |   1151 |   |-|~|!|{}|\|\||\+)*.*(?:.*=.*)))  
 | 
|  |   1152 |   \end{verbatim}
 | 
|  |   1153 |   \end{center}\bigskip\bigskip\bigskip\bigskip\bigskip\bigskip\bigskip    
 | 
|  |   1154 |   
 | 
|  |   1155 |   \item on 20 July 2016 the \textbf{Stack Exchange} webpage went down
 | 
|  |   1156 |     because of an evil regular expression
 | 
| 984 |   1157 |     \here{https://stackstatus.tumblr.com/post/147710624694/outage-postmortem-july-20-2016}    
 | 
| 876 |   1158 |   \end{itemize}
 | 
|  |   1159 |   
 | 
|  |   1160 |   \begin{textblock}{6}(6,7.6)
 | 
|  |   1161 |     \includegraphics[scale=0.14]{../pics/cloudflare.png}\\
 | 
|  |   1162 |     \footnotesize
 | 
|  |   1163 |     It serves more web traffic than Twitter, Amazon, Apple,
 | 
|  |   1164 |     Instagram, Bing \& Wikipedia combined.
 | 
|  |   1165 |     \here{https://blog.cloudflare.com/details-of-the-cloudflare-outage-on-july-2-2019/}
 | 
|  |   1166 |     \end{textblock}
 | 
|  |   1167 |   
 | 
|  |   1168 |   \end{frame}
 | 
|  |   1169 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%     
 | 
|  |   1170 |     
 | 
|  |   1171 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 | 
|  |   1172 | \begin{frame}[c]
 | 
|  |   1173 | \frametitle{Evil Regular Expressions}
 | 
|  |   1174 | 
 | 
|  |   1175 | \begin{itemize}
 | 
|  |   1176 | \item \alert{R}egular \alert{e}xpression \alert{D}enial \alert{o}f \alert{S}ervice (ReDoS)\medskip
 | 
|  |   1177 | \item Some evil regular expressions:\medskip
 | 
|  |   1178 | \begin{itemize}
 | 
|  |   1179 | \item \bl{\texttt{[a?]\{n\}\;[a]\{n\}}}
 | 
|  |   1180 | \item \bl{\texttt{(a*)*\;b}}  
 | 
|  |   1181 | \item \bl{\texttt{([a-z]+)*}} 
 | 
|  |   1182 | \item \bl{\texttt{(a + aa)*}}
 | 
|  |   1183 | \item \bl{\texttt{(a + a?)*}}
 | 
|  |   1184 | \end{itemize}
 | 
|  |   1185 | 
 | 
|  |   1186 | \item sometimes also called \alert{catastrophic backtracking}
 | 
|  |   1187 | \item this is a problem for \alert{N}etwork \alert{I}ntrusion
 | 
|  |   1188 |   \alert{D}etection systems, Cloudflare, StackExchange, Atom editor
 | 
|  |   1189 | \item \url{https://vimeo.com/112065252}  
 | 
|  |   1190 | \end{itemize}
 | 
|  |   1191 | 
 | 
|  |   1192 | \end{frame}
 | 
|  |   1193 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 | 
|  |   1194 | 
 | 
| 929 |   1195 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
 | 
| 964 |   1196 | % {
 | 
|  |   1197 | % \setbeamercolor{background canvas}{bg=cream}
 | 
|  |   1198 | % \begin{frame}[c]
 | 
|  |   1199 | % \frametitle{Rust vs.~Scala (from PEP)}
 | 
| 929 |   1200 | 
 | 
| 964 |   1201 | % \mbox{}
 | 
| 929 |   1202 | 
 | 
| 964 |   1203 | % \begin{minipage}{1.3\textwidth}
 | 
|  |   1204 | % \begin{mybox3}{}\it\small
 | 
|  |   1205 | % \textbf{Re: Another question of purely academic interest about regex implementation in cw3}
 | 
| 929 |   1206 | 
 | 
| 964 |   1207 | % This conversation is interesting to me, and I've researched it a
 | 
|  |   1208 | % little bit [...] I also disagree with Dr.~Urban on the cost/benefit of
 | 
|  |   1209 | % non-GC languages [...]\smallskip
 | 
| 929 |   1210 | 
 | 
| 964 |   1211 | % But regardless, Scala is a lot slower than, say, C or Rust. To say
 | 
|  |   1212 | % it's not is basically wrong (imo). Perhaps one could argue that some
 | 
|  |   1213 | % of the guarantees Scala has makes it easier to write multi-threaded
 | 
|  |   1214 | % programs that utilise more of the CPU... but, in my opinion, this is
 | 
|  |   1215 | % also a bit misleading. Most CPUs have something like 4 to 12 cores
 | 
|  |   1216 | % nowadays. It's very possible that a given Scala program runs 4-12x
 | 
|  |   1217 | % slower than its Rust equivalent. Would you rather have your program
 | 
|  |   1218 | % run quickly and use a single core, or have it run equally
 | 
|  |   1219 | % quickly... and... hog your entire CPU for its duration?\ldots{}
 | 
| 929 |   1220 | 
 | 
| 964 |   1221 | % \mbox{}\hfill-- Oliver Iliffe,  discussion from PEP
 | 
|  |   1222 | % \end{mybox3}
 | 
|  |   1223 | % \end{minipage}
 | 
| 929 |   1224 | 
 | 
| 964 |   1225 | % \end{frame}
 | 
|  |   1226 | % }
 | 
| 929 |   1227 | 
 | 
|  |   1228 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
 | 
| 964 |   1229 | % {
 | 
|  |   1230 | % \setbeamercolor{background canvas}{bg=cream}
 | 
|  |   1231 | % \begin{frame}[c]
 | 
|  |   1232 | % \frametitle{Regex Lib in Rust}
 | 
| 929 |   1233 | 
 | 
| 964 |   1234 | % \begin{center}
 | 
|  |   1235 | % \includegraphics[scale=0.34]{../pics/rust-regex.png}
 | 
|  |   1236 | % \end{center}
 | 
| 929 |   1237 | 
 | 
| 964 |   1238 | % \end{frame}
 | 
|  |   1239 | % }
 | 
| 929 |   1240 | 
 | 
|  |   1241 | 
 | 
|  |   1242 | 
 | 
|  |   1243 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 | 
| 964 |   1244 | % {
 | 
|  |   1245 | % \setbeamercolor{background canvas}{bg=cream}
 | 
|  |   1246 | % \begin{frame}[c,fragile]
 | 
| 929 |   1247 | 
 | 
| 964 |   1248 | % \begin{columns}[t,onlytextwidth]
 | 
|  |   1249 | % \begin{column}{1\textwidth}
 | 
|  |   1250 | % \small re: \bl{$(abc)^{\{n\}}$}\quad str: \bl{$\underbrace{abc\ldots{}abc}_n$}\medskip\\  
 | 
|  |   1251 | % \begin{tikzpicture}\footnotesize
 | 
|  |   1252 | % \begin{axis}[
 | 
|  |   1253 | %     xlabel={$n$},
 | 
|  |   1254 | %     x label style={at={(1.07,0.0)}},
 | 
|  |   1255 | %     ylabel={time in secs},
 | 
|  |   1256 | %     enlargelimits=false,
 | 
|  |   1257 | %     xmax=65000,
 | 
|  |   1258 | %     ymax=100,
 | 
|  |   1259 | %     xtick={0,15000,...,60000},
 | 
|  |   1260 | %     ytick={0,10,...,90},
 | 
|  |   1261 | %     scaled ticks=false,
 | 
|  |   1262 | %     axis lines=left,
 | 
|  |   1263 | %     width=7cm,
 | 
|  |   1264 | %     height=5cm]
 | 
|  |   1265 | %     \addplot[black,mark=square*,mark options={fill=red}] table [x=x, y=y, col sep=comma, row sep=crcr]
 | 
|  |   1266 | %     {x, y\\
 | 
|  |   1267 | %       0, 0\\
 | 
|  |   1268 | %      5000, 0.487\\ 
 | 
|  |   1269 | %      10000, 1.650\\
 | 
|  |   1270 | %      15000, 3.617\\
 | 
|  |   1271 | %      20000, 6.462\\
 | 
|  |   1272 | %      25000, 10.736\\
 | 
|  |   1273 | %      30000, 17.665\\
 | 
|  |   1274 | %      35000, 25.662\\
 | 
|  |   1275 | %      40000, 36.422\\
 | 
|  |   1276 | %      45000, 49.119\\
 | 
|  |   1277 | %      50000, 62.058\\
 | 
|  |   1278 | %      55000, 75.941\\
 | 
|  |   1279 | %      60000, 93.022\\
 | 
|  |   1280 | %     };
 | 
|  |   1281 | % \end{axis}
 | 
|  |   1282 | % \end{tikzpicture}
 | 
|  |   1283 | % \end{column}
 | 
|  |   1284 | % \end{columns}
 | 
| 929 |   1285 | 
 | 
| 964 |   1286 | % \begin{textblock}{10}(8.4,3.8)
 | 
|  |   1287 | % \tiny  
 | 
|  |   1288 | % \begin{lstlisting}[language=Rust]
 | 
|  |   1289 | % extern crate regex;
 | 
| 929 |   1290 | 
 | 
| 964 |   1291 | % use regex::Regex;
 | 
|  |   1292 | % use std::time::Instant;
 | 
| 929 |   1293 | 
 | 
| 964 |   1294 | % // bounded regular expression example
 | 
| 929 |   1295 | 
 | 
| 964 |   1296 | % fn main() {
 | 
|  |   1297 | %    for bound in (0..=60000).step_by(5000) {
 | 
| 929 |   1298 |    
 | 
| 964 |   1299 | %       let re = Regex::new(&format!("(abc){{{}}}", bound)).unwrap();
 | 
|  |   1300 | %       let text = "abc".repeat(bound);
 | 
| 929 |   1301 | 
 | 
| 964 |   1302 | %       let start_time = Instant::now();
 | 
|  |   1303 | %       let is_match = re.is_match(&text);
 | 
|  |   1304 | %       let elapsed_time = start_time.elapsed().as_secs_f64();
 | 
| 929 |   1305 | 
 | 
| 964 |   1306 | %       println!("Bound: {}, Match: {}, Time: {} seconds", bound, is_match, elapsed_time);
 | 
|  |   1307 | %    }
 | 
|  |   1308 | % }
 | 
|  |   1309 | % \end{lstlisting}    
 | 
|  |   1310 | % \end{textblock}
 | 
|  |   1311 | % \end{frame}
 | 
|  |   1312 | % }  
 | 
| 929 |   1313 | 
 | 
|  |   1314 | 
 | 
| 876 |   1315 | 
 | 
|  |   1316 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 | 
|  |   1317 | %\begin{frame}[c]
 | 
|  |   1318 | %\frametitle{Today}
 | 
|  |   1319 | %
 | 
|  |   1320 | %\begin{itemize}
 | 
|  |   1321 | %\item While the ultimate goal is to implement a small compiler for the JVM
 | 
|  |   1322 | %  \ldots\bigskip
 | 
|  |   1323 | %\end{itemize}
 | 
|  |   1324 | %
 | 
|  |   1325 | %Let's start with:
 | 
|  |   1326 | %
 | 
|  |   1327 | %\begin{itemize}
 | 
|  |   1328 | %\item a web-crawler
 | 
|  |   1329 | %\item an email harvester
 | 
|  |   1330 | %\item \textcolor{gray}{(a web-scraper)}
 | 
|  |   1331 | %\end{itemize}
 | 
|  |   1332 | %
 | 
|  |   1333 | %\end{frame}
 | 
|  |   1334 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%  
 | 
|  |   1335 | 
 | 
|  |   1336 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 | 
|  |   1337 | %\begin{frame}[t]
 | 
|  |   1338 | %\frametitle{A Web-Crawler}
 | 
|  |   1339 | %
 | 
|  |   1340 | %\mbox{}\\[10mm]
 | 
|  |   1341 | %
 | 
|  |   1342 | %\begin{enumerate}
 | 
|  |   1343 | %\item given an URL, read the corresponding webpage
 | 
|  |   1344 | %\item extract all links from it
 | 
|  |   1345 | %\item call the web-crawler again for all these links
 | 
|  |   1346 | %\end{enumerate}
 | 
|  |   1347 | %
 | 
|  |   1348 | %\end{frame}
 | 
|  |   1349 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
 | 
|  |   1350 | 
 | 
|  |   1351 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 | 
|  |   1352 | %\begin{frame}[t]
 | 
|  |   1353 | %\frametitle{A Web-Crawler}
 | 
|  |   1354 | %
 | 
|  |   1355 | %\mbox{}\\[10mm]
 | 
|  |   1356 | %
 | 
|  |   1357 | %
 | 
|  |   1358 | %\begin{enumerate}
 | 
|  |   1359 | %\item given an URL, read the corresponding webpage
 | 
|  |   1360 | %\item if not possible print, out a problem
 | 
|  |   1361 | %\item if possible, extract all links from it
 | 
|  |   1362 | %\item call the web-crawler again for all these links
 | 
|  |   1363 | %\end{enumerate}\bigskip\pause
 | 
|  |   1364 | %
 | 
|  |   1365 | %\small (we need a bound for the number of recursive calls)
 | 
|  |   1366 | %
 | 
|  |   1367 | %\small (the purpose is to check all links on my own webpage)
 | 
|  |   1368 | %\end{frame}
 | 
|  |   1369 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
 | 
|  |   1370 | 
 | 
|  |   1371 | 
 | 
|  |   1372 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 | 
|  |   1373 | %\begin{frame}[c]
 | 
|  |   1374 | %
 | 
|  |   1375 | %\begin{textblock}{1}(2,5)
 | 
|  |   1376 | %\begin{tabular}{c}
 | 
|  |   1377 | %\includegraphics[scale=0.15]{pics/servers.png}\\[-2mm]
 | 
|  |   1378 | %\small Server
 | 
|  |   1379 | %\end{tabular}
 | 
|  |   1380 | %\end{textblock}
 | 
|  |   1381 | %
 | 
|  |   1382 | %\begin{textblock}{1}(5.6,4)
 | 
|  |   1383 | %  \begin{tikzpicture}[scale=1.1]
 | 
|  |   1384 | %  \draw[white] (0,1) node (X) {};
 | 
|  |   1385 | %  \draw[white] (2,1) node (Y) {};
 | 
|  |   1386 | %   \draw[white] (0,0) node (X1) {};
 | 
|  |   1387 | %  \draw[white] (2,0) node (Y1) {};
 | 
|  |   1388 | %   \draw[white] (0,-1) node (X2) {};
 | 
|  |   1389 | %  \draw[white] (2,-1) node (Y2) {};
 | 
|  |   1390 | %  \draw[red, <-, line width = 2mm] (X) -- (Y);
 | 
|  |   1391 | %  \node [inner sep=5pt,label=above:\textcolor{black}{GET request}] at ($ (X)!.5!(Y) $) {};
 | 
|  |   1392 | %  \draw[red, ->, line width = 2mm] (X1) -- (Y1);
 | 
|  |   1393 | %  \node [inner sep=5pt,label=above:\textcolor{black}{webpage}] at ($ (X1)!.5!(Y1) $) {};
 | 
|  |   1394 | %  \draw[red, <-, line width = 2mm] (X2) -- (Y2);
 | 
|  |   1395 | %  \node [inner sep=7pt,label=above:\textcolor{black}{POST data}] at ($ (X2)!.5!(Y2) $) {};
 | 
|  |   1396 | %  \end{tikzpicture}
 | 
|  |   1397 | %\end{textblock}
 | 
|  |   1398 | %
 | 
|  |   1399 | %
 | 
|  |   1400 | %\begin{textblock}{1}(9,5.5)
 | 
|  |   1401 | %\begin{tabular}{c}
 | 
|  |   1402 | %\includegraphics[scale=0.15]{pics/laptop.png}\\[-2mm]
 | 
|  |   1403 | %\small Browser
 | 
|  |   1404 | %\end{tabular}
 | 
|  |   1405 | %\end{textblock}
 | 
|  |   1406 | %\end{frame}
 | 
|  |   1407 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
 | 
|  |   1408 | 
 | 
|  |   1409 |   
 | 
|  |   1410 | 
 | 
|  |   1411 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 | 
|  |   1412 | %\begin{frame}[c]
 | 
|  |   1413 | %\frametitle{Scala}
 | 
|  |   1414 | %
 | 
|  |   1415 | %\small A simple Scala function for reading webpages:
 | 
|  |   1416 | %\bigskip
 | 
|  |   1417 | %
 | 
|  |   1418 | %\footnotesize
 | 
|  |   1419 | %\lstinputlisting{../progs/app0.scala}
 | 
|  |   1420 | %\medskip\pause
 | 
|  |   1421 | %
 | 
|  |   1422 | %\lstinline{get_page("""https://nms.kcl.ac.uk/christian.urban/""")}
 | 
|  |   1423 | %\bigskip\medskip\pause
 | 
|  |   1424 | %
 | 
|  |   1425 | %
 | 
|  |   1426 | %\small A slightly more complicated version for handling errors:
 | 
|  |   1427 | %\smallskip
 | 
|  |   1428 | %
 | 
|  |   1429 | %\footnotesize
 | 
|  |   1430 | %\lstinputlisting[xleftmargin=-4mm]{../progs/app1.scala}
 | 
|  |   1431 | %
 | 
|  |   1432 | %
 | 
|  |   1433 | %\end{frame}
 | 
|  |   1434 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
 | 
|  |   1435 | 
 | 
|  |   1436 |  
 | 
|  |   1437 | 
 | 
|  |   1438 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 | 
|  |   1439 | %\begin{frame}[t]
 | 
|  |   1440 | %\frametitle{A Regular Expression}
 | 
|  |   1441 | %
 | 
|  |   1442 | %\begin{itemize}
 | 
|  |   1443 | %\item \ldots{} is a pattern or template for specifying strings
 | 
|  |   1444 | %\end{itemize}\bigskip
 | 
|  |   1445 | %  
 | 
|  |   1446 | %\begin{center}  
 | 
|  |   1447 | %\only<1>{\scode{"https?://[^"]*"}}%
 | 
|  |   1448 | %\only<2>{\scode{""""https?://[^"]*"""".r}}
 | 
|  |   1449 | %\end{center}\bigskip\bigskip
 | 
|  |   1450 | %
 | 
|  |   1451 | %matches for example\smallskip\\  
 | 
|  |   1452 | %\hspace{2mm}\code{"http://www.foobar.com"}\\
 | 
|  |   1453 | %\hspace{2mm}\code{"https://www.tls.org"}\smallskip\\
 | 
|  |   1454 | %
 | 
|  |   1455 | %but not\smallskip\\  
 | 
|  |   1456 | %\hspace{2mm}\code{"http://www."foo"bar.com"}\\
 | 
|  |   1457 | %
 | 
|  |   1458 | %\end{frame}
 | 
|  |   1459 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
 | 
|  |   1460 | 
 | 
|  |   1461 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 | 
|  |   1462 | %\begin{frame}[c]
 | 
|  |   1463 | %\frametitle{Finding Operations in Scala}
 | 
|  |   1464 | %
 | 
|  |   1465 | %{\bf\code{rexp.findAllIn(string)}}\medskip
 | 
|  |   1466 | %  
 | 
|  |   1467 | %returns a list of all (sub)strings that match the 
 | 
|  |   1468 | %regular expression
 | 
|  |   1469 | %\bigskip\bigskip  
 | 
|  |   1470 | %  
 | 
|  |   1471 | %
 | 
|  |   1472 | %{\bf\code{rexp.findFirstIn(string)}}\medskip
 | 
|  |   1473 | % 
 | 
|  |   1474 | %returns either 
 | 
|  |   1475 | %
 | 
|  |   1476 | %\begin{itemize}
 | 
|  |   1477 | %\item \code{None} if no (sub)string matches or 
 | 
|  |   1478 | %\item \code{Some(s)} with the first (sub)string
 | 
|  |   1479 | %\end{itemize}
 | 
|  |   1480 | %
 | 
|  |   1481 | %\end{frame}
 | 
|  |   1482 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
 | 
|  |   1483 | 
 | 
|  |   1484 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 | 
|  |   1485 | %\begin{frame}[c]
 | 
|  |   1486 | %
 | 
|  |   1487 | %\footnotesize
 | 
|  |   1488 | %\lstinputlisting{../progs/app2.scala}
 | 
|  |   1489 | %
 | 
|  |   1490 | %\end{frame}
 | 
|  |   1491 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
 | 
|  |   1492 | 
 | 
|  |   1493 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 | 
|  |   1494 | %\begin{frame}[c]
 | 
|  |   1495 | %
 | 
|  |   1496 | %\small
 | 
|  |   1497 | %A version that only crawls links in ``my'' domain:\bigskip
 | 
|  |   1498 | %
 | 
|  |   1499 | %\footnotesize
 | 
|  |   1500 | %\lstinputlisting{../progs/app3.scala}
 | 
|  |   1501 | %
 | 
|  |   1502 | %\end{frame}
 | 
|  |   1503 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
 | 
|  |   1504 | 
 | 
|  |   1505 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 | 
|  |   1506 | %\begin{frame}[c]
 | 
|  |   1507 | %\lstset{xleftmargin=-4mm}
 | 
|  |   1508 | %\small
 | 
|  |   1509 | %A little email harvester:
 | 
|  |   1510 | %
 | 
|  |   1511 | %\footnotesize
 | 
|  |   1512 | %\lstinputlisting{../progs/app4.scala}\bigskip
 | 
|  |   1513 | %
 | 
|  |   1514 | %\tiny
 | 
|  |   1515 | %\url{http://net.tutsplus.com/tutorials/other/8-regular-expressions-you-should-know/}
 | 
|  |   1516 | %
 | 
|  |   1517 | %\end{frame}
 | 
|  |   1518 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
 | 
|  |   1519 | 
 | 
|  |   1520 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 | 
|  |   1521 | \begin{frame}[t]
 | 
|  |   1522 | \frametitle{(Basic) Regular Expressions}
 | 
|  |   1523 | 
 | 
|  |   1524 | Their inductive definition:
 | 
|  |   1525 | 
 | 
|  |   1526 | 
 | 
|  |   1527 | \begin{textblock}{6}(2,7.5)
 | 
|  |   1528 |   \begin{tabular}{@ {}rrl@ {\hspace{13mm}}l}
 | 
|  |   1529 |   \bl{$r$} & \bl{$::=$}  & \bl{$\ZERO$}  & nothing\\
 | 
|  |   1530 |          & \bl{$\mid$} & \bl{$\ONE$}       & empty string / \pcode{""} / $[]$\\
 | 
|  |   1531 |          & \bl{$\mid$} & \bl{$c$}                         & character\\
 | 
|  |   1532 |          & \bl{$\mid$} & \bl{$r_1 + r_2$}  & alternative / choice\\
 | 
|  |   1533 |          & \bl{$\mid$} & \bl{$r_1 \cdot r_2$} & sequence\\
 | 
|  |   1534 |          & \bl{$\mid$} & \bl{$r^*$}            & star (zero or more)\\
 | 
|  |   1535 |   \end{tabular}
 | 
|  |   1536 |   \end{textblock}
 | 
|  |   1537 |   
 | 
|  |   1538 |   
 | 
|  |   1539 | \only<2->{\footnotesize
 | 
|  |   1540 | \begin{textblock}{9}(2,0.5)
 | 
|  |   1541 | \begin{bubble}[9.8cm]
 | 
|  |   1542 | \lstinputlisting{../progs/app01.scala}
 | 
|  |   1543 | \end{bubble}
 | 
|  |   1544 | \end{textblock}}
 | 
|  |   1545 |   
 | 
|  |   1546 | \end{frame}
 | 
|  |   1547 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
 | 
|  |   1548 | 
 | 
|  |   1549 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 | 
|  |   1550 | %\begin{frame}[t]
 | 
|  |   1551 | %\frametitle{Regular Expressions}
 | 
|  |   1552 | %
 | 
|  |   1553 | %\small
 | 
|  |   1554 | %In Scala:\bigskip
 | 
|  |   1555 | %
 | 
|  |   1556 | %\footnotesize
 | 
|  |   1557 | %\lstinputlisting{../progs/app51.scala}
 | 
|  |   1558 | %
 | 
|  |   1559 | %  
 | 
|  |   1560 | %\end{frame}
 | 
|  |   1561 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
 | 
|  |   1562 | 
 | 
|  |   1563 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 | 
|  |   1564 | \begin{frame}[t]
 | 
|  |   1565 | \frametitle{Strings}
 | 
|  |   1566 | 
 | 
|  |   1567 | \ldots are lists of characters. For example \code{"hello"}
 | 
|  |   1568 | 
 | 
|  |   1569 | \begin{center}
 | 
|  |   1570 | \bl{$[h, e, l, l, o]$} or just \bl{$hello$}
 | 
|  |   1571 | \end{center}
 | 
|  |   1572 | 
 | 
|  |   1573 | the empty string: \bl{$[]$} or \bl{\pcode{""}}\bigskip\\
 | 
|  |   1574 | 
 | 
|  |   1575 | the concatenation of two strings:
 | 
|  |   1576 | 
 | 
|  |   1577 | \begin{center}
 | 
|  |   1578 | \bl{$s_1 \,@\, s_2$}
 | 
|  |   1579 | \end{center}
 | 
|  |   1580 | 
 | 
|  |   1581 | \bl{\textit{foo $@$ bar = foobar}}\\
 | 
|  |   1582 | \bl{\textit{baz $@\, []$ = baz}}
 | 
|  |   1583 |   
 | 
|  |   1584 | \end{frame}
 | 
|  |   1585 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
 | 
|  |   1586 | 
 | 
|  |   1587 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 | 
|  |   1588 | \begin{frame}[c]
 | 
|  |   1589 | \frametitle{Languages, Strings}
 | 
|  |   1590 | 
 | 
|  |   1591 | \begin{itemize}
 | 
|  |   1592 | \item \alert{\bf Strings} are lists of characters, for example
 | 
|  |   1593 | \begin{center}
 | 
|  |   1594 | \bl{$[]$},\;\bl{$abc$}  \hspace{2cm}(Pattern match: \bl{$c\!::\!s$})
 | 
|  |   1595 | \end{center}\bigskip
 | 
|  |   1596 | 
 | 
|  |   1597 | 
 | 
|  |   1598 | \item A \alert{\bf language} is a set of strings, for example\medskip
 | 
|  |   1599 | \begin{center}
 | 
|  |   1600 | \bl{$\{[], hello, \textit{foobar}, a, abc\}$}
 | 
|  |   1601 | \end{center}\bigskip
 | 
|  |   1602 | 
 | 
|  |   1603 | \item \alert{\bf Concatenation} of strings and languages
 | 
|  |   1604 | 
 | 
|  |   1605 | \begin{center}
 | 
|  |   1606 | \begin{tabular}{rcl}
 | 
|  |   1607 | \bl{$\textit{foo}\;@\;bar$} & \bl{$=$} & \bl{$\textit{foobar}$}\medskip\\
 | 
|  |   1608 | \bl{$A\;@\;B$} & \bl{$\dn$} & \bl{$\{ s_1\,@\,s_2 \;\mid\; s_1 \in A \wedge s_2 \in B\}$}
 | 
|  |   1609 | \end{tabular}
 | 
|  |   1610 | \end{center}
 | 
|  |   1611 | 
 | 
|  |   1612 | %\item The \alert{\bf meaning} of a regular expression is a set of 
 | 
|  |   1613 | %  strings, or language.
 | 
|  |   1614 | \end{itemize}  
 | 
|  |   1615 | 
 | 
|  |   1616 | \only<2>{
 | 
|  |   1617 | \begin{textblock}{4}(10.5,8)
 | 
|  |   1618 | \small
 | 
|  |   1619 | Let
 | 
|  |   1620 | 
 | 
|  |   1621 | \bl{$A = \{foo, bar\}$} \bl{$B = \{a, b\}$}
 | 
|  |   1622 | \[
 | 
|  |   1623 | \bl{A \,@\, B = \{fooa, foob, bara, barb\}}
 | 
|  |   1624 | \]
 | 
|  |   1625 | \end{textblock}}  
 | 
|  |   1626 | 
 | 
|  |   1627 | \end{frame}
 | 
|  |   1628 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
 | 
|  |   1629 | 
 | 
|  |   1630 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 | 
|  |   1631 | \begin{frame}[c]
 | 
|  |   1632 |   \frametitle{Two Corner Cases}
 | 
|  |   1633 |    
 | 
|  |   1634 |   \Large
 | 
|  |   1635 |   \begin{center}
 | 
|  |   1636 |   \bl{$A \,@\, \{[]\} = \;?$}\bigskip\bigskip\pause\\
 | 
|  |   1637 |   \bl{$A \,@\, \{\} = \;?$}
 | 
|  |   1638 |   \end{center}  
 | 
|  |   1639 |     
 | 
|  |   1640 |   \end{frame}
 | 
|  |   1641 |   %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%  
 | 
|  |   1642 |   
 | 
|  |   1643 | 
 | 
|  |   1644 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 | 
|  |   1645 | \begin{frame}[c]
 | 
|  |   1646 | \frametitle{The Meaning of a Regex}
 | 
|  |   1647 | 
 | 
|  |   1648 |  ...all the strings a regular expression can match.   
 | 
|  |   1649 | 
 | 
|  |   1650 | \begin{center}
 | 
|  |   1651 |  \begin{tabular}{rcl}
 | 
|  |   1652 |  \bl{$L(\ZERO)$}  & \bl{$\dn$} & \bl{$\{\}$}\\
 | 
|  |   1653 |  \bl{$L(\ONE)$}     & \bl{$\dn$} & \bl{$\{[]\}$}\\
 | 
|  |   1654 |  \bl{$L(c)$}            & \bl{$\dn$} & \bl{$\{[c]\}$}\\
 | 
|  |   1655 |  \bl{$L(r_1 + r_2)$}    & \bl{$\dn$} & \bl{$L(r_1) \cup L(r_2)$}\\
 | 
|  |   1656 |  \bl{$L(r_1 \cdot r_2)$} & \bl{$\dn$} & \bl{$L(r_1) \,@\, L(r_2)$}\\
 | 
|  |   1657 |  \bl{$L(r^*)$}           & \bl{$\dn$} & \\
 | 
|  |   1658 |   \end{tabular}
 | 
|  |   1659 | \end{center}
 | 
|  |   1660 | 
 | 
|  |   1661 | \begin{textblock}{14}(1.5,13.5)\small
 | 
|  |   1662 | \bl{$L$} is a function from regular expressions to 
 | 
|  |   1663 | sets of strings (languages):\smallskip\\
 | 
|  |   1664 | \bl{\quad$L$ : Rexp $\Rightarrow$ Set$[$String$]$}
 | 
|  |   1665 | \end{textblock}
 | 
|  |   1666 | 
 | 
|  |   1667 | \end{frame}
 | 
|  |   1668 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 | 
|  |   1669 | 
 | 
|  |   1670 | 
 | 
|  |   1671 | 
 | 
|  |   1672 | 
 | 
|  |   1673 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 | 
|  |   1674 | \begin{frame}[c]
 | 
|  |   1675 |   \frametitle{The Power Operation}
 | 
|  |   1676 |   
 | 
|  |   1677 |   \begin{itemize}
 | 
|  |   1678 |   \item The \alert{\textbf{\boldmath$n$th Power}} of a language:
 | 
|  |   1679 |   
 | 
|  |   1680 |   \begin{center}
 | 
|  |   1681 |   \begin{tabular}{lcl}
 | 
|  |   1682 |   \bl{$A^0$}    & \bl{$\dn$} & \bl{$\{[]\}$}\\
 | 
|  |   1683 |   \bl{$A^{n+1}$} & \bl{$\dn$} & \bl{$A \,@\, A^n$}
 | 
|  |   1684 |   \end{tabular}
 | 
|  |   1685 |   \end{center}\bigskip
 | 
|  |   1686 |   
 | 
|  |   1687 |   \item[] For example
 | 
|  |   1688 |   
 | 
|  |   1689 |   \begin{center}
 | 
|  |   1690 |   \begin{tabular}{lcl@{\hspace{10mm}}l}
 | 
|  |   1691 |   \bl{$A^4$} & \bl{$=$} & \bl{$A \,@\, A \,@\, A \,@\, A$} & \bl{$(@\,\{[]\})$}\\
 | 
|  |   1692 |   \bl{$A^1$} & \bl{$=$} & \bl{$A$} & \bl{$(@\,\{[]\})$}\\
 | 
|  |   1693 |   \bl{$A^0$} & \bl{$=$} & \bl{$\{[]\}$}\\
 | 
|  |   1694 |   \end{tabular}
 | 
|  |   1695 |   \end{center}
 | 
|  |   1696 |   
 | 
|  |   1697 |   \end{itemize}  
 | 
|  |   1698 |   
 | 
|  |   1699 |   \end{frame}
 | 
|  |   1700 |   %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 | 
|  |   1701 |   
 | 
|  |   1702 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 | 
|  |   1703 | \begin{frame}[c]
 | 
|  |   1704 | \frametitle{The Meaning of a Regex}
 | 
|  |   1705 | 
 | 
|  |   1706 | \begin{textblock}{15}(1,4)
 | 
|  |   1707 |  \begin{tabular}{rcl}
 | 
|  |   1708 |  \bl{$L(\ZERO)$}  & \bl{$\dn$} & \bl{$\{\}$}\\
 | 
|  |   1709 |  \bl{$L(\ONE)$}     & \bl{$\dn$} & \bl{$\{[]\}$}\\
 | 
|  |   1710 |  \bl{$L(c)$}            & \bl{$\dn$} & \bl{$\{[c]\}$}\\
 | 
|  |   1711 |  \bl{$L(r_1 + r_2)$}    & \bl{$\dn$} & \bl{$L(r_1) \cup L(r_2)$}\\
 | 
|  |   1712 |  \bl{$L(r_1 \cdot r_2)$} & \bl{$\dn$} & \bl{$\{ s_1 \,@\, s_2 \;|\; s_1 \in L(r_1) \wedge s_2 \in L(r_2) \}$}\\
 | 
|  |   1713 |  \bl{$L(r^*)$}           & \bl{$\dn$} & \onslide<2->{\bl{$\bigcup_{0 \le n} L(r)^n$}}\\
 | 
|  |   1714 |   \end{tabular}\bigskip
 | 
|  |   1715 |   
 | 
|  |   1716 | %\onslide<2->{
 | 
|  |   1717 | %\hspace{5mm}\bl{$L(r)^0 \;\dn\; \{[]\}$}\\
 | 
|  |   1718 | %\bl{$L(r)^{n+1} \;\dn\; L(r) \,@\, L(r)^n$}\hspace{9mm}\onslide<3->{\small\textcolor{gray}{(append on sets)}\\
 | 
|  |   1719 | %\small\hspace{5cm}\textcolor{gray}{$\{ s_1 @ s_2 \;|\; s_1\in L(r) \wedge s_2 \in L(r)^n \}$}}
 | 
|  |   1720 | %}  
 | 
|  |   1721 | \end{textblock}
 | 
|  |   1722 | 
 | 
|  |   1723 | \end{frame}
 | 
|  |   1724 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
 | 
|  |   1725 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 | 
|  |   1726 | \begin{frame}[c]
 | 
|  |   1727 |   \frametitle{The Star Operation}
 | 
|  |   1728 |   
 | 
|  |   1729 |   \begin{itemize}
 | 
|  |   1730 |   \item The \alert{\bf Kleene Star} of a \underline{language}:
 | 
|  |   1731 |   \bigskip
 | 
|  |   1732 |   
 | 
|  |   1733 |   \begin{center}
 | 
|  |   1734 |   \begin{tabular}{c}
 | 
|  |   1735 |   \bl{$A\star \dn \bigcup_{0\le n} A^n$}
 | 
|  |   1736 |   \end{tabular}
 | 
|  |   1737 |   \end{center}\bigskip
 | 
|  |   1738 |   
 | 
|  |   1739 |   \item[] This expands to 
 | 
|  |   1740 |   
 | 
|  |   1741 |   \[
 | 
|  |   1742 |   \bl{A^0 \cup A^1 \cup A^2 \cup A^3 \cup A^4 \cup \ldots}
 | 
|  |   1743 |   \]
 | 
|  |   1744 |   
 | 
|  |   1745 |   or
 | 
|  |   1746 |   
 | 
|  |   1747 |   \small
 | 
|  |   1748 |   \[
 | 
|  |   1749 |   \bl{\{[]\} \;\cup\; A \;\cup\; A\,@\,A \;\cup\; 
 | 
|  |   1750 |     A\,@\,A\,@\,A \;\cup\; A\,@\,A\,@\,A\,@\,A \cup \ldots}
 | 
|  |   1751 |   \]
 | 
|  |   1752 |   
 | 
|  |   1753 |   \end{itemize}  
 | 
|  |   1754 |   
 | 
|  |   1755 |   \end{frame}
 | 
|  |   1756 |   %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
 | 
|  |   1757 | 
 | 
|  |   1758 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 | 
|  |   1759 | \begin{frame}[c]
 | 
|  |   1760 | \frametitle{The Meaning of a Regex}
 | 
|  |   1761 | 
 | 
|  |   1762 | \begin{textblock}{15}(1,4)
 | 
|  |   1763 |  \begin{tabular}{rcl}
 | 
|  |   1764 |  \bl{$L(\ZERO)$}  & \bl{$\dn$} & \bl{$\{\}$}\\
 | 
|  |   1765 |  \bl{$L(\ONE)$}     & \bl{$\dn$} & \bl{$\{[]\}$}\\
 | 
|  |   1766 |  \bl{$L(c)$}            & \bl{$\dn$} & \bl{$\{[c]\}$}\\
 | 
|  |   1767 |  \bl{$L(r_1 + r_2)$}    & \bl{$\dn$} & \bl{$L(r_1) \cup L(r_2)$}\\
 | 
|  |   1768 |  \bl{$L(r_1 \cdot r_2)$} & \bl{$\dn$} & \bl{$\{ s_1 \,@\, s_2 \;|\; s_1 \in L(r_1) \wedge s_2 \in L(r_2) \}$}\\
 | 
|  |   1769 |  \bl{$L(r^*)$}           & \bl{$\dn$} & \bl{$(L(r))\star$}\\
 | 
|  |   1770 |   \end{tabular}
 | 
|  |   1771 |   
 | 
|  |   1772 | \end{textblock}
 | 
|  |   1773 | 
 | 
|  |   1774 | \end{frame}
 | 
|  |   1775 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 | 
|  |   1776 | 
 | 
|  |   1777 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 | 
|  |   1778 | \begin{frame}[c]
 | 
|  |   1779 | \frametitle{The Meaning of Matching}
 | 
|  |   1780 | 
 | 
|  |   1781 | \begin{bubble}[10cm]
 | 
|  |   1782 | \large\bf 
 | 
|  |   1783 | A regular expression \bl{$r$} matches a string~\bl{$s$} 
 | 
|  |   1784 | provided
 | 
|  |   1785 | 
 | 
|  |   1786 | \begin{center}
 | 
|  |   1787 | \bl{$s \in L(r)$}\\ 
 | 
|  |   1788 | \end{center}
 | 
|  |   1789 | \end{bubble}\bigskip\bigskip
 | 
|  |   1790 | 
 | 
|  |   1791 | \ldots and the point of the next lecture is 
 | 
|  |   1792 | to decide this problem as fast as possible (unlike Python,
 | 
|  |   1793 | Ruby, Java)
 | 
|  |   1794 | 
 | 
|  |   1795 | \end{frame}
 | 
| 879 |   1796 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 | 
|  |   1797 | 
 | 
|  |   1798 | 
 | 
| 876 |   1799 | 
 | 
|  |   1800 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 | 
|  |   1801 | \begin{frame}[c]
 | 
|  |   1802 |   \frametitle{Questions}
 | 
|  |   1803 |   
 | 
|  |   1804 |   \begin{itemize}
 | 
|  |   1805 |   \item Say \bl{$A = \{[a],[b],[c],[d]\}$}.\bigskip
 | 
|  |   1806 |   
 | 
|  |   1807 |   \item[]
 | 
|  |   1808 |   How many strings are in \bl{$A^4$}\,?
 | 
|  |   1809 |   \bigskip\medskip\pause
 | 
|  |   1810 |   
 | 
|  |   1811 |   
 | 
|  |   1812 |  \item[]
 | 
|  |   1813 |   What if \bl{$A = \{[a],[b],[c],[]\}$};\\ 
 | 
|  |   1814 |   how many strings are then in \bl{$A^4$}\,?
 | 
|  |   1815 |   \end{itemize}  
 | 
|  |   1816 |   
 | 
|  |   1817 | \end{frame}
 | 
|  |   1818 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%  
 | 
|  |   1819 | 
 | 
|  |   1820 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 | 
| 879 |   1821 | \begin{frame}[c]
 | 
|  |   1822 |   \frametitle{Questions}
 | 
|  |   1823 | 
 | 
|  |   1824 |   \begin{itemize}
 | 
|  |   1825 |   \item Assume a set $A$ contains 4 strings and a set $B$
 | 
|  |   1826 |   contains 7 strings. None of the strings is the empty
 | 
|  |   1827 |   string.
 | 
|  |   1828 | 
 | 
|  |   1829 |   \item How many strings are in $A \,@\, B$?
 | 
|  |   1830 |   \end{itemize}
 | 
|  |   1831 | 
 | 
|  |   1832 |   
 | 
|  |   1833 | \end{frame}
 | 
|  |   1834 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%  
 | 
|  |   1835 | 
 | 
| 929 |   1836 | {
 | 
|  |   1837 | \setbeamercolor{background canvas}{bg=cream}
 | 
|  |   1838 | \begin{frame}[c]
 | 
|  |   1839 | 
 | 
|  |   1840 | \begin{minipage}{1.3\textwidth}
 | 
|  |   1841 | 
 | 
|  |   1842 | \end{minipage}
 | 
|  |   1843 | \includegraphics[scale=0.4]{../pics/chatgpt.png}
 | 
|  |   1844 | \end{frame}
 | 
|  |   1845 | }
 | 
|  |   1846 | 
 | 
|  |   1847 | {
 | 
|  |   1848 | \setbeamercolor{background canvas}{bg=cream}
 | 
|  |   1849 | \begin{frame}[c]
 | 
|  |   1850 | \frametitle{\dots{}for amusement}
 | 
|  |   1851 | 
 | 
|  |   1852 | \begin{minipage}{1.3\textwidth}
 | 
|  |   1853 | \includegraphics[scale=0.4]{../pics/chatgpt1.png}
 | 
|  |   1854 | \end{minipage}
 | 
|  |   1855 | 
 | 
|  |   1856 | \end{frame}
 | 
|  |   1857 | }
 | 
|  |   1858 | 
 | 
| 879 |   1859 | 
 | 
|  |   1860 | 
 | 
|  |   1861 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 | 
| 876 |   1862 | % \begin{frame}[c]
 | 
|  |   1863 | % \frametitle{Languages (Sets of Strings)}
 | 
|  |   1864 | 
 | 
|  |   1865 | % \begin{itemize}
 | 
|  |   1866 | 
 | 
|  |   1867 | % \item A \alert{\bf Language} is a set of strings, for example\medskip
 | 
|  |   1868 | % \begin{center}
 | 
|  |   1869 | % \bl{$\{[], hello, foobar, a, abc\}$}
 | 
|  |   1870 | % \end{center}\bigskip
 | 
|  |   1871 | 
 | 
|  |   1872 | % \item \alert{\bf Concatenation} for strings and languages
 | 
|  |   1873 | 
 | 
|  |   1874 | % \begin{center}
 | 
|  |   1875 | % \begin{tabular}{rcl}
 | 
|  |   1876 | % \bl{$foo\;@\;bar$} & \bl{$=$} & \bl{$foobar$}\medskip\\
 | 
|  |   1877 | % \bl{$A\;@\;B$}     & \bl{$\dn$} & \bl{$\{ s_1\,@\,s_2 \;\mid\; s_1 \in A \wedge s_2 \in B\}$}
 | 
|  |   1878 | % \end{tabular}
 | 
|  |   1879 | % \end{center}
 | 
|  |   1880 | % \bigskip
 | 
|  |   1881 | 
 | 
|  |   1882 | % \small
 | 
|  |   1883 | % \item [] For example \bl{$A = \{foo, bar\}$}, \bl{$B = \{a, b\}$}
 | 
|  |   1884 | 
 | 
|  |   1885 | % \[
 | 
|  |   1886 | % \bl{A \,@\, B = \{fooa, foob, bara, barb\}}
 | 
|  |   1887 | % \]
 | 
|  |   1888 | 
 | 
|  |   1889 | 
 | 
|  |   1890 | 
 | 
|  |   1891 | 
 | 
|  |   1892 | % \end{itemize}  
 | 
|  |   1893 | % \end{frame}
 | 
|  |   1894 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
 | 
|  |   1895 | 
 | 
|  |   1896 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 | 
|  |   1897 | % \begin{frame}[c]
 | 
|  |   1898 | %   \frametitle{Two Corner Cases}
 | 
|  |   1899 |    
 | 
|  |   1900 | %   \Large
 | 
|  |   1901 | %   \begin{center}
 | 
|  |   1902 | %   \bl{$A \,@\, \{[]\} = \;?$}\bigskip\bigskip\pause\\
 | 
|  |   1903 | %   \bl{$A \,@\, \{\} = \;?$}
 | 
|  |   1904 | %   \end{center}  
 | 
|  |   1905 |     
 | 
|  |   1906 | %   \end{frame}
 | 
|  |   1907 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%  
 | 
|  |   1908 |   
 | 
|  |   1909 | 
 | 
|  |   1910 | 
 | 
|  |   1911 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 | 
|  |   1912 | % \begin{frame}[c]
 | 
|  |   1913 | % \frametitle{The Meaning of a Regex}
 | 
|  |   1914 | 
 | 
|  |   1915 | %  ...all the strings a regular expression can match.   
 | 
|  |   1916 | 
 | 
|  |   1917 | % \begin{center}
 | 
|  |   1918 | %  \begin{tabular}{rcl}
 | 
|  |   1919 | %  \bl{$L(\ZERO)$}  & \bl{$\dn$} & \bl{$\{\}$}\\
 | 
|  |   1920 | %  \bl{$L(\ONE)$}     & \bl{$\dn$} & \bl{$\{[]\}$}\\
 | 
|  |   1921 | %  \bl{$L(c)$}            & \bl{$\dn$} & \bl{$\{[c]\}$}\\
 | 
|  |   1922 | %  \bl{$L(r_1 + r_2)$}    & \bl{$\dn$} & \bl{$L(r_1) \cup L(r_2)$}\\
 | 
|  |   1923 | %  \bl{$L(r_1 \cdot r_2)$} & \bl{$\dn$} & \bl{$L(r_1) \,@\, L(r_2)$}\\
 | 
|  |   1924 | %  \bl{$L(r^*)$}           & \bl{$\dn$} & \\
 | 
|  |   1925 | %   \end{tabular}
 | 
|  |   1926 | % \end{center}
 | 
|  |   1927 | 
 | 
|  |   1928 | % \begin{textblock}{14}(1.5,13.5)\small
 | 
|  |   1929 | % \bl{$L$} is a function from regular expressions to 
 | 
|  |   1930 | % sets of strings (languages):\smallskip\\
 | 
|  |   1931 | % \bl{\quad$L$ : Rexp $\Rightarrow$ Set$[$String$]$}
 | 
|  |   1932 | % \end{textblock}
 | 
|  |   1933 | 
 | 
|  |   1934 | % \end{frame}
 | 
|  |   1935 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 | 
|  |   1936 | 
 | 
|  |   1937 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 | 
|  |   1938 | % \begin{frame}[c]
 | 
|  |   1939 | % \frametitle{The Power Operation}
 | 
|  |   1940 | 
 | 
|  |   1941 | % \begin{itemize}
 | 
|  |   1942 | % \item The \alert{\textbf{\boldmath$n$th Power}} of a language:
 | 
|  |   1943 | 
 | 
|  |   1944 | % \begin{center}
 | 
|  |   1945 | % \begin{tabular}{lcl}
 | 
|  |   1946 | % \bl{$A^0$}    & \bl{$\dn$} & \bl{$\{[]\}$}\\
 | 
|  |   1947 | % \bl{$A^{n+1}$} & \bl{$\dn$} & \bl{$A \,@\, A^n$}
 | 
|  |   1948 | % \end{tabular}
 | 
|  |   1949 | % \end{center}\bigskip
 | 
|  |   1950 | 
 | 
|  |   1951 | % \item[] For example
 | 
|  |   1952 | 
 | 
|  |   1953 | % \begin{center}
 | 
|  |   1954 | % \begin{tabular}{lcl@{\hspace{10mm}}l}
 | 
|  |   1955 | % \bl{$A^4$} & \bl{$=$} & \bl{$A \,@\, A \,@\, A \,@\, A$} & \bl{$(@\,\{[]\})$}\\
 | 
|  |   1956 | % \bl{$A^1$} & \bl{$=$} & \bl{$A$} & \bl{$(@\,\{[]\})$}\\
 | 
|  |   1957 | % \bl{$A^0$} & \bl{$=$} & \bl{$\{[]\}$}\\
 | 
|  |   1958 | % \end{tabular}
 | 
|  |   1959 | % \end{center}
 | 
|  |   1960 | 
 | 
|  |   1961 | % \end{itemize}  
 | 
|  |   1962 | 
 | 
|  |   1963 | % \end{frame}
 | 
|  |   1964 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
 | 
|  |   1965 | 
 | 
|  |   1966 | 
 | 
|  |   1967 | 
 | 
|  |   1968 | 
 | 
|  |   1969 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 | 
|  |   1970 | % \begin{frame}[c]
 | 
|  |   1971 | % \frametitle{Written Exam}
 | 
|  |   1972 | 
 | 
|  |   1973 | % \begin{itemize}
 | 
|  |   1974 | % \item Accounts for 80\%.\bigskip
 | 
|  |   1975 | 
 | 
|  |   1976 | % \item The question ``\textit{Is this relevant for
 | 
|  |   1977 | %       the exam?}'' is very demotivating for the lecturer!\bigskip\\
 | 
|  |   1978 | 
 | 
|  |   1979 | % \item Deal: Whatever is in the homework (and is not marked
 | 
|  |   1980 | %       ``\textit{optional}'') is relevant for the exam.\bigskip
 | 
|  |   1981 |       
 | 
|  |   1982 | % \item Each lecture has also a handout. There are also handouts about
 | 
|  |   1983 | % notation and Scala.      
 | 
|  |   1984 | % \end{itemize}
 | 
|  |   1985 | 
 | 
|  |   1986 | % \end{frame}
 | 
|  |   1987 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
 | 
|  |   1988 | 
 | 
|  |   1989 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 | 
|  |   1990 | % \begin{frame}[t]
 | 
|  |   1991 | % \frametitle{Coursework}
 | 
|  |   1992 | 
 | 
|  |   1993 | % \begin{itemize}
 | 
|  |   1994 | % \item Accounts for 20\%. Two strands. Choose \alert{\bf one}!\bigskip
 | 
|  |   1995 | % \end{itemize}
 | 
|  |   1996 | 
 | 
|  |   1997 | % \begin{columns}[t]
 | 
|  |   1998 | % \begin{column}{.5\textwidth}
 | 
|  |   1999 | % \underline{\bf Strand 1}\medskip
 | 
|  |   2000 | % \begin{itemize}
 | 
|  |   2001 | % \item 4 programming tasks:
 | 
|  |   2002 | % \begin{itemize}
 | 
|  |   2003 | % \item matcher (4\%, 11.10.) 
 | 
|  |   2004 | % \item lexer (5\%, 04.11.)
 | 
|  |   2005 | % \item parser (5\%, 22.11.)
 | 
|  |   2006 | % \item compiler (6\%, 13.12.)
 | 
|  |   2007 | % \end{itemize}
 | 
|  |   2008 | % \item in any lang.~you like,\\ but I want to see the\\ code
 | 
|  |   2009 | % \end{itemize}
 | 
|  |   2010 | % \end{column}
 | 
|  |   2011 | 
 | 
|  |   2012 | % \hspace{-45pt}\vrule{}\hspace{10pt}
 | 
|  |   2013 | % \begin{column}{.5\textwidth}
 | 
|  |   2014 | % \underline{\bf Strand 2}\smallskip\begin{itemize}
 | 
|  |   2015 | % \item one task: prove the correctness of a regular expression matcher in 
 | 
|  |   2016 | % the \underline{Isabelle} theorem prover
 | 
|  |   2017 | % \item 20\%, submission on~13.12.\hspace{-5mm}\mbox{}
 | 
|  |   2018 | % \end{itemize}
 | 
|  |   2019 | % \end{column}
 | 
|  |   2020 | % \end{columns}\medskip
 | 
|  |   2021 | 
 | 
|  |   2022 | % \small
 | 
|  |   2023 | % \begin{itemize}
 | 
|  |   2024 | % \item Solving more than one strand will {\bf not} give you more 
 | 
|  |   2025 | % marks.
 | 
|  |   2026 | 
 | 
|  |   2027 | % \end{itemize}
 | 
|  |   2028 | 
 | 
|  |   2029 | % \end{frame}
 | 
|  |   2030 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
 | 
|  |   2031 | 
 | 
|  |   2032 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 | 
|  |   2033 | %\begin{frame}[c]
 | 
|  |   2034 | %\frametitle{Lecture Capture}
 | 
|  |   2035 | %
 | 
|  |   2036 | %\begin{itemize}
 | 
|  |   2037 | %\item Hope it works\ldots\pause actually no, it does not!\medskip\pause
 | 
|  |   2038 | %\item It is important to use lecture capture wisely\\ (it is only the ``baseline''):
 | 
|  |   2039 | %\begin{itemize}  
 | 
|  |   2040 | %\item Lecture recordings are a study and revision aid.
 | 
|  |   2041 | %\item Statistically, there is a clear and direct link between attendance and
 | 
|  |   2042 | %  attainment: students who do not attend lectures, do less well in exams.
 | 
|  |   2043 | %\end{itemize}
 | 
|  |   2044 | %
 | 
|  |   2045 | %\item Attending a lecture is more than watching it online -- if you do not
 | 
|  |   2046 | %attend, you miss out!  
 | 
|  |   2047 | %  
 | 
|  |   2048 | %\end{itemize}
 | 
|  |   2049 | %
 | 
|  |   2050 | %\end{frame}
 | 
|  |   2051 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
 | 
|  |   2052 | 
 | 
|  |   2053 | 
 | 
|  |   2054 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 | 
|  |   2055 | \begin{frame}[c]
 | 
| 928 |   2056 | \frametitle{\begin{tabular}{c}\\[1cm]\alert{Questions?}\end{tabular}}
 | 
| 876 |   2057 | 
 | 
|  |   2058 | 
 | 
|  |   2059 | \begin{tabular}{lll}
 | 
| 989 |   2060 |   SGT TAs:  & Flavio Melinte Citea\\
 | 
|  |   2061 |             & Zoltan Meszaros\bigskip\\
 | 
| 998 |   2062 | Amm + Github & Flavio Melinte Citea & (flavio.melinte\_citea@kcl.ac.uk)\\
 | 
|  |   2063 | Helpers     & Zishan Rahman & (zishan.rahman@kcl.ac.uk)\medskip\\
 | 
| 876 |   2064 | \end{tabular}  
 | 
|  |   2065 | \mbox{}
 | 
|  |   2066 | \end{frame}
 | 
|  |   2067 | 
 | 
| 998 |   2068 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 | 
|  |   2069 | \begin{frame}[c]
 | 
|  |   2070 | 
 | 
|  |   2071 | \begin{center}
 | 
|  |   2072 | \begin{tabular}{c}
 | 
|  |   2073 | \includegraphics[scale=0.024]{awards.jpeg}\\
 | 
|  |   2074 | \small I try my best, but \ldots
 | 
|  |   2075 | \end{tabular} 
 | 
|  |   2076 | \end{center} 
 | 
|  |   2077 | \mbox{}
 | 
|  |   2078 | \end{frame}
 | 
|  |   2079 | 
 | 
| 876 |   2080 | \begin{frame}[c]
 | 
|  |   2081 | \end{frame}
 | 
|  |   2082 | 
 | 
|  |   2083 | \begin{frame}[c]
 | 
|  |   2084 | \end{frame}
 | 
|  |   2085 | 
 | 
|  |   2086 | \begin{frame}[c]
 | 
|  |   2087 | \end{frame}
 | 
|  |   2088 | 
 | 
|  |   2089 | \begin{frame}[c]
 | 
|  |   2090 | \end{frame}
 | 
|  |   2091 | 
 | 
|  |   2092 | \begin{frame}[c]
 | 
|  |   2093 | \end{frame}
 | 
|  |   2094 | 
 | 
|  |   2095 | \begin{frame}[c]
 | 
|  |   2096 | \end{frame}
 | 
|  |   2097 | 
 | 
|  |   2098 | \begin{frame}[c]
 | 
|  |   2099 | \end{frame}
 | 
|  |   2100 | 
 | 
|  |   2101 | \begin{frame}[c]
 | 
|  |   2102 | \end{frame}
 | 
|  |   2103 | 
 | 
|  |   2104 | \begin{frame}[c]
 | 
|  |   2105 | \end{frame}
 | 
|  |   2106 | 
 | 
|  |   2107 | \begin{frame}[c]
 | 
|  |   2108 | \end{frame}
 | 
|  |   2109 | 
 | 
|  |   2110 | \begin{frame}[c]
 | 
|  |   2111 | \end{frame}
 | 
|  |   2112 | 
 | 
|  |   2113 | \begin{frame}[c]
 | 
|  |   2114 | \end{frame}
 | 
|  |   2115 | 
 | 
|  |   2116 | \begin{frame}[c]
 | 
|  |   2117 | \end{frame}
 | 
|  |   2118 | 
 | 
|  |   2119 | \begin{frame}[c]
 | 
|  |   2120 | \end{frame}
 | 
|  |   2121 | 
 | 
|  |   2122 | \begin{frame}[c]
 | 
|  |   2123 | \begin{mybox3}{What is the trick?}\small
 | 
|  |   2124 |   What was the trick to improve the evil regular expressions matcher
 | 
|  |   2125 |   to have such good results compared to other programming languages?
 | 
|  |   2126 |   Is it working better on casual regular expressions (the ones that
 | 
|  |   2127 |   Python and Java handle pretty well), too? Or was it just optimised
 | 
|  |   2128 |   for these evil ones?
 | 
|  |   2129 | \end{mybox3}
 | 
|  |   2130 | \end{frame}
 | 
|  |   2131 | 
 | 
| 998 |   2132 | \begin{frame}[c]
 | 
|  |   2133 | \begin{mybox3}{No Regex at Amazon AWS}\small
 | 
|  |   2134 | My friend who works at Amazon AWS told me they try to avoid 
 | 
|  |   2135 | regexes whenever they can. So kind of echoes this joke from the week 
 | 
|  |   2136 | 1 handout.
 | 
|  |   2137 | 
 | 
|  |   2138 | \begin{quote}
 | 
|  |   2139 | “Sometimes you have a programming problem and it seems like the 
 | 
|  |   2140 | best solution is to use regular expressions; now you have two problems.”
 | 
|  |   2141 | \end{quote}
 | 
|  |   2142 | 
 | 
|  |   2143 | \end{mybox3}
 | 
|  |   2144 | \end{frame}
 | 
|  |   2145 | 
 | 
| 876 |   2146 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 | 
|  |   2147 | \begin{frame}[c]
 | 
|  |   2148 |   \frametitle{Thanks to Martin Mikusovic}
 | 
|  |   2149 | 
 | 
|  |   2150 | \bigskip    
 | 
|  |   2151 | \begin{center}
 | 
|  |   2152 | \begin{tikzpicture}
 | 
|  |   2153 |   \begin{axis}[
 | 
|  |   2154 |     xlabel={$n$},
 | 
|  |   2155 |     x label style={at={(1.05,0.0)}},
 | 
|  |   2156 |     ylabel={time in secs},
 | 
|  |   2157 |     enlargelimits=false,
 | 
|  |   2158 |     xtick={0,5,...,30},
 | 
|  |   2159 |     xmax=33,
 | 
|  |   2160 |     ymax=35,
 | 
|  |   2161 |     ytick={0,10,...,30},
 | 
|  |   2162 |     scaled ticks=false,
 | 
|  |   2163 |     axis lines=left,
 | 
|  |   2164 |     width=9cm,
 | 
|  |   2165 |     height=5.5cm, 
 | 
|  |   2166 |     legend entries={Java 8, Python, JavaScript, Swift},  
 | 
|  |   2167 |     legend pos=north west,
 | 
|  |   2168 |     legend cell align=left]
 | 
|  |   2169 | \addplot[blue,mark=*, mark options={fill=white}] table {re-python2.data};
 | 
|  |   2170 | \addplot[cyan,mark=*, mark options={fill=white}] table {re-java.data};
 | 
|  |   2171 | \addplot[red,mark=*, mark options={fill=white}] table {re-js.data};
 | 
|  |   2172 | \addplot[magenta,mark=*, mark options={fill=white}] table {re-swift.data};
 | 
|  |   2173 | \end{axis}
 | 
|  |   2174 | \end{tikzpicture}
 | 
|  |   2175 | \end{center}
 | 
|  |   2176 | 
 | 
|  |   2177 | Regex: \bl{$(a^*)^* \cdot b$}
 | 
|  |   2178 | 
 | 
|  |   2179 | Strings of the form \bl{$\underbrace{\,a\ldots a\,}_{n}$}
 | 
|  |   2180 | 
 | 
|  |   2181 | \end{frame}
 | 
|  |   2182 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 | 
|  |   2183 | 
 | 
|  |   2184 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 | 
|  |   2185 | \begin{frame}[c]
 | 
|  |   2186 | \frametitle{Same Example in Java 9+}
 | 
|  |   2187 | 
 | 
|  |   2188 | \begin{center}
 | 
|  |   2189 | \begin{tikzpicture}
 | 
|  |   2190 |   \begin{axis}[
 | 
|  |   2191 |     xlabel={$n$},
 | 
|  |   2192 |     x label style={at={(1.09,-0.15)}},
 | 
|  |   2193 |     ylabel={time in secs},
 | 
|  |   2194 |     scaled x ticks=false,
 | 
|  |   2195 |     enlargelimits=false,
 | 
|  |   2196 |     xtick distance=10000,
 | 
|  |   2197 |     xmax=44000, 
 | 
|  |   2198 |     ytick={0,10,...,30}, 
 | 
|  |   2199 |     ymax=35, 
 | 
|  |   2200 |     axis lines=left,
 | 
|  |   2201 |     width=9cm,
 | 
|  |   2202 |     height=5cm, 
 | 
|  |   2203 |     legend entries={Java \liningnums{9}+},
 | 
|  |   2204 |     legend pos=north west,
 | 
|  |   2205 |     legend cell align=left]
 | 
|  |   2206 | \addplot[blue,mark=square*,mark options={fill=white}] table {re-java9.data};
 | 
|  |   2207 | \end{axis}
 | 
|  |   2208 | \end{tikzpicture}
 | 
|  |   2209 | \end{center}
 | 
|  |   2210 | 
 | 
|  |   2211 | Regex: \bl{$(a^*)^* \cdot b$}
 | 
|  |   2212 | 
 | 
|  |   2213 | Strings of the form \bl{$\underbrace{\,a\ldots a\,}_{n}$}
 | 
|  |   2214 | 
 | 
|  |   2215 | \end{frame}
 | 
|  |   2216 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 | 
|  |   2217 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 | 
|  |   2218 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 | 
|  |   2219 | % Questions
 | 
|  |   2220 | 
 | 
|  |   2221 | 
 | 
|  |   2222 | 
 | 
|  |   2223 | 
 | 
|  |   2224 | \begin{frame}[c]
 | 
|  |   2225 | \end{frame}
 | 
|  |   2226 | 
 | 
|  |   2227 | \begin{frame}[c]
 | 
|  |   2228 | \end{frame}
 | 
|  |   2229 | 
 | 
|  |   2230 | \begin{frame}[c]
 | 
|  |   2231 | \end{frame}
 | 
|  |   2232 | 
 | 
|  |   2233 | \begin{frame}[c]
 | 
|  |   2234 | \end{frame}
 | 
|  |   2235 | 
 | 
| 879 |   2236 | \begin{frame}[c]
 | 
| 876 |   2237 | 
 | 
|  |   2238 | \end{frame}
 | 
|  |   2239 | 
 | 
|  |   2240 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
 | 
|  |   2241 | \end{document}
 | 
|  |   2242 | 
 | 
|  |   2243 | %%% Local Variables:  
 | 
|  |   2244 | %%% mode: latex
 | 
|  |   2245 | %%% TeX-master: t
 | 
|  |   2246 | %%% End: 
 | 
|  |   2247 | 
 |