| author | Christian Urban <christian.urban@kcl.ac.uk> | 
| Wed, 23 Sep 2020 11:34:43 +0100 | |
| changeset 761 | fb07ac060866 | 
| parent 758 | 91b9b361e0f0 | 
| child 762 | 500dfc51914d | 
| permissions | -rw-r--r-- | 
| 631 | 1 | % !TEX program = xelatex | 
| 743 | 2 | \documentclass[dvipsnames,14pt,t,xelatex,aspectratio=169,xcolor={table}]{beamer}
 | 
| 252 
e8ef8f38ca84
added style files
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
215diff
changeset | 3 | \usepackage{../slides}
 | 
| 
e8ef8f38ca84
added style files
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
215diff
changeset | 4 | \usepackage{../graphics}
 | 
| 215 
828303e8e4af
updated slides
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
98diff
changeset | 5 | \usepackage{../langs}
 | 
| 
828303e8e4af
updated slides
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
98diff
changeset | 6 | \usepackage{../data}
 | 
| 0 | 7 | |
| 754 | 8 | \usepackage{tcolorbox}
 | 
| 9 | \newtcolorbox{mybox}{colback=red!5!white,colframe=red!75!black}
 | |
| 10 | \newtcolorbox{mybox2}[1]{colback=red!5!white,colframe=red!75!black,fonttitle=\bfseries,title=#1}
 | |
| 11 | \newtcolorbox{mybox3}[1]{colback=Cyan!5!white,colframe=Cyan!75!black,fonttitle=\bfseries,title=#1}
 | |
| 12 | ||
| 743 | 13 | |
| 14 | ||
| 252 
e8ef8f38ca84
added style files
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
215diff
changeset | 15 | \hfuzz=220pt | 
| 
e8ef8f38ca84
added style files
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
215diff
changeset | 16 | |
| 254 
dcd4688690ce
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
253diff
changeset | 17 | \lstset{language=Scala,
 | 
| 
dcd4688690ce
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
253diff
changeset | 18 | style=mystyle, | 
| 
dcd4688690ce
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
253diff
changeset | 19 | numbersep=0pt, | 
| 
dcd4688690ce
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
253diff
changeset | 20 | numbers=none, | 
| 
dcd4688690ce
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
253diff
changeset | 21 | xleftmargin=0mm} | 
| 
dcd4688690ce
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
253diff
changeset | 22 | |
| 253 
75c469893514
added coursework
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
252diff
changeset | 23 | \newcommand{\bl}[1]{\textcolor{blue}{#1}}     
 | 
| 559 | 24 | |
| 0 | 25 | % beamer stuff | 
| 428 
a47c4227a0c6
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
334diff
changeset | 26 | \renewcommand{\slidecaption}{CFL 01, King's College London}
 | 
| 0 | 27 | |
| 721 
e712943cff71
added slides from Rochester
 Christian Urban <christian.urban@kcl.ac.uk> parents: 
637diff
changeset | 28 | %% https://cs.rit.edu/~hh/teaching/_media/cc18/lectures/lect1/main.pdf | 
| 
e712943cff71
added slides from Rochester
 Christian Urban <christian.urban@kcl.ac.uk> parents: 
637diff
changeset | 29 | %% https://cs.rit.edu/~hh/teaching/_media/cc18/lectures/lect2/main.pdf | 
| 
e712943cff71
added slides from Rochester
 Christian Urban <christian.urban@kcl.ac.uk> parents: 
637diff
changeset | 30 | %% https://cs.rit.edu/~hh/teaching/_media/cc18/lectures/lect3/main.pdf | 
| 0 | 31 | |
| 32 | \begin{document}
 | |
| 33 | ||
| 758 | 34 | %\begin{frame}[t]
 | 
| 35 | %\begin{mybox}
 | |
| 36 | %A physical explanation the \emph{dynamic matrix}\\
 | |
| 37 | %lots of text | |
| 38 | %\end{mybox}
 | |
| 743 | 39 | |
| 40 | ||
| 758 | 41 | %\begin{mybox2}{Test}
 | 
| 42 | %A physical explanation the \emph{dynamic matrix}\\
 | |
| 43 | %lots of text | |
| 44 | %\end{mybox2}
 | |
| 754 | 45 | |
| 758 | 46 | %\begin{mybox3}{Test}
 | 
| 47 | %A physical explanation the \emph{dynamic matrix}\\
 | |
| 48 | %lots of text | |
| 49 | %\end{mybox3}
 | |
| 50 | %\end{frame}
 | |
| 754 | 51 | |
| 0 | 52 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | 
| 253 
75c469893514
added coursework
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
252diff
changeset | 53 | \begin{frame}[t]
 | 
| 510 | 54 | \frametitle{%  
 | 
| 0 | 55 |   \begin{tabular}{@ {}c@ {}}
 | 
| 1 | 56 | \\[-3mm] | 
| 428 
a47c4227a0c6
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
334diff
changeset | 57 | \LARGE Compilers and \\[-1mm] | 
| 743 | 58 | \LARGE Formal Languages\\[-3mm] | 
| 0 | 59 |   \end{tabular}}
 | 
| 60 | ||
| 61 |   \begin{center}
 | |
| 507 | 62 |   %\includegraphics[scale=0.3]{pics/ante1.jpg}\hspace{5mm}
 | 
| 63 |   %\includegraphics[scale=0.31]{pics/ante2.jpg}\\
 | |
| 64 |   %\footnotesize\textcolor{gray}{Antikythera automaton, 100 BC (Archimedes?)}
 | |
| 0 | 65 |   \end{center}
 | 
| 66 | ||
| 510 | 67 | \normalsize | 
| 0 | 68 |   \begin{center}
 | 
| 69 |   \begin{tabular}{ll}
 | |
| 70 | Email: & christian.urban at kcl.ac.uk\\ | |
| 743 | 71 | %Office Hours: & Thursdays 12 -- 14\\ | 
| 72 | %Location: & N7.07 (North Wing, Bush House)\\ | |
| 631 | 73 | Slides \& Progs: & KEATS\\ | 
| 0 | 74 |   \end{tabular}
 | 
| 75 |   \end{center}
 | |
| 76 | ||
| 743 | 77 |   \begin{center}
 | 
| 78 |     \begin{tikzpicture}
 | |
| 79 | \node[drop shadow,fill=white,inner sep=0pt] | |
| 80 |       {\footnotesize\rowcolors{1}{capri!10}{white}
 | |
| 81 |         \begin{tabular}{|p{4.8cm}|p{4.8cm}|}\hline
 | |
| 82 |           \cellcolor{blue!50}
 | |
| 83 | 1 Introduction, Languages & 6 While-Language \\ | |
| 84 | 2 Regular Expressions, Derivatives & 7 Compilation, JVM \\ | |
| 85 | 3 Automata, Regular Languages & 8 Compiling Functional Languages \\ | |
| 86 | 4 Lexing, Tokenising & 9 Optimisations \\ | |
| 87 | 5 Grammars, Parsing & 10 LLVM \\ \hline | |
| 88 |         \end{tabular}%
 | |
| 89 | }; | |
| 90 |     \end{tikzpicture}
 | |
| 91 |   \end{center}
 | |
| 92 | ||
| 253 
75c469893514
added coursework
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
252diff
changeset | 93 | \end{frame}
 | 
| 559 | 94 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | 
| 0 | 95 | |
| 96 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
| 756 | 97 | \begin{frame}<1-12>[c]
 | 
| 744 | 98 | \frametitle{The Goal of this Module\ldots}
 | 
| 99 | ||
| 100 | \begin{center}
 | |
| 101 |   \begin{tikzpicture}[scale=1,
 | |
| 102 |                       node/.style={
 | |
| 103 | rectangle,rounded corners=3mm, | |
| 104 | very thick,draw=black!50,minimum height=18mm, minimum width=20mm, | |
| 105 | top color=white,bottom color=black!20,drop shadow}] | |
| 106 | ||
| 107 |   \node at (3.05, 1.8) {\Large\bf \ldots{} you write a compiler};
 | |
| 108 | ||
| 109 |   \node (0) at (-2.3,0) {};  
 | |
| 110 | \node [above=5mm of 0] | |
| 111 |   {\makebox[0mm]{\footnotesize
 | |
| 112 |       \begin{tabular}{@{}l@{}}input\\[-1mm]program\end{tabular}}}; 
 | |
| 113 | ||
| 114 |   \node (A) at (0,0)  [node] {};
 | |
| 115 |   \node [below right] at (A.north west) {lexer};
 | |
| 116 | ||
| 117 |   \node (B) at (3,0)  [node] {};
 | |
| 118 |   \node [below right=1mm] at (B.north west) {\mbox{}\hspace{-1mm}parser};
 | |
| 119 | ||
| 120 |   \node (C) at (6,0)  [node] {};
 | |
| 121 |   \node [below right] at (C.north west) {\mbox{}\hspace{-1mm}code gen};
 | |
| 122 | ||
| 123 |   \node (1) at (8.4,0) {};
 | |
| 124 | \node [above=5mm of 1] | |
| 125 |   {\makebox[0mm]{\footnotesize
 | |
| 126 |       \begin{tabular}{@{}r@{}}binary\\[-1mm]code\end{tabular}}};
 | |
| 127 | ||
| 128 | \draw [->,line width=4mm] (0) -- (A); | |
| 129 | \draw [->,line width=4mm] (A) -- (B); | |
| 130 | \draw [->,line width=4mm] (B) -- (C); | |
| 131 | \draw [->,line width=4mm] (C) -- (1); | |
| 132 |   \end{tikzpicture}
 | |
| 133 |   \end{center}
 | |
| 134 | ||
| 135 | \only<2,3,4>{
 | |
| 136 | \begin{textblock}{1}(1,2.1)
 | |
| 137 | \begin{bubble}[9.8cm]
 | |
| 138 | \normalsize | |
| 139 | lexer input: a string\smallskip\\ | |
| 140 | \hspace{5mm}\code{"read(n);"}\medskip\\
 | |
| 141 | lexer output: a sequence of tokens\smallskip\\ | |
| 142 | \hspace{5mm}\code{key(read) lpar id(n) rpar semi}
 | |
| 143 | \end{bubble}
 | |
| 144 | \end{textblock}} 
 | |
| 145 | ||
| 146 | \only<3,4>{
 | |
| 147 | \begin{textblock}{1}(6,7.8)
 | |
| 148 | \begin{tabular}{c}
 | |
| 149 | \includegraphics[scale=0.2]{../pics/rosetta.jpg}\\[-2mm]
 | |
| 150 | \footnotesize lexing $\Rightarrow$ recognising words (Stone of Rosetta) | |
| 151 | \end{tabular}
 | |
| 152 | \end{textblock}}
 | |
| 153 | ||
| 154 | \only<4>{
 | |
| 155 | \begin{textblock}{1}(0.5,12)\small
 | |
| 156 | \begin{tabular}{l@{}c@{}l}
 | |
| 157 |   \pcode{if}    & $\;\Rightarrow\;$ & keyword\\
 | |
| 158 |   \pcode{iffoo} & $\;\Rightarrow\;$ & identifier\\
 | |
| 159 | \end{tabular}  
 | |
| 160 | \end{textblock}}
 | |
| 161 | ||
| 162 | \only<6>{
 | |
| 163 | \begin{textblock}{1}(1,1.5)
 | |
| 164 | \begin{bubble}[8.5cm]
 | |
| 165 | \normalsize | |
| 166 | parser input: a sequence of tokens\smallskip\\ | |
| 167 | ||
| 168 | {\small\hspace{5mm}\code{key(read) lpar id(n) rpar semi}}\smallskip\\
 | |
| 169 | ||
| 170 | parser output: an abstract syntax tree\smallskip\\ | |
| 171 | \footnotesize | |
| 172 | \hspace{2cm}\begin{tikzpicture}
 | |
| 173 |   \node {\code{read}}
 | |
| 174 |     child {node {\code{lpar}}}
 | |
| 175 |     child {node {\code{n}}}
 | |
| 176 |     child {node {\code{rpar}}};
 | |
| 177 | \end{tikzpicture}
 | |
| 178 | \end{bubble}
 | |
| 179 | \end{textblock}}
 | |
| 180 | ||
| 181 | \only<8,9>{
 | |
| 182 | \begin{textblock}{1}(1,1.5)
 | |
| 183 | \begin{bubble}[4cm]
 | |
| 184 | \normalsize | |
| 185 | code generation:\smallskip\\ | |
| 186 | \hspace{5mm}\code{istore 2}\\ 
 | |
| 187 | \hspace{5mm}\code{iload 2}\\ 
 | |
| 188 | \hspace{5mm}\code{ldc 10}\\
 | |
| 189 | \hspace{5mm}\code{isub}\\
 | |
| 190 | \hspace{5mm}\code{ifeq Label2}\\ 
 | |
| 191 | \hspace{5mm}\code{iload 2}\\
 | |
| 192 | \hspace{5mm}\code{...}\\
 | |
| 193 | \end{bubble}
 | |
| 194 | \end{textblock}}
 | |
| 195 | ||
| 196 | \only<9>{
 | |
| 197 | \begin{textblock}{6}(8.4,7)
 | |
| 198 | \begin{bubble}[5cm]
 | |
| 199 | \mbox{\begin{tikzpicture}[scale=0.58,rounded corners=0mm]
 | |
| 200 | \begin{axis}[axis x line=bottom, axis y line=left, ylabel=secs,
 | |
| 201 | xlabel=n, | |
| 202 | enlargelimits=0.05, | |
| 203 | ybar interval=0.7, legend style=small] | |
| 204 | \addplot file {interpreted2.data};
 | |
| 205 | \addplot file {compiled2.data};
 | |
| 206 | %\legend{interpreted, compiled}
 | |
| 207 | \end{axis}
 | |
| 208 | \end{tikzpicture}}
 | |
| 209 | \end{bubble}
 | |
| 210 | \end{textblock}}
 | |
| 211 | ||
| 212 | \only<10>{
 | |
| 213 | \begin{textblock}{6}(1,3)
 | |
| 214 |   \begin{bubble}[11cm]
 | |
| 756 | 215 |     Compiler explorers, e.g.: \url{https://gcc.godbolt.org} \;\video{https://youtu.be/ysaBmhMEyUg}
 | 
| 744 | 216 |   \begin{tikzpicture}[]
 | 
| 217 |   \node (0) at (-2.3,0) {\includegraphics[scale=0.3]{pics/csource.png}};
 | |
| 218 |   \node (1) [right=35mm] at (0) {\includegraphics[scale=0.3]{pics/cassmbl.png}}; 
 | |
| 219 | \draw [->,line width=4mm, red] (0) -- (1); | |
| 756 | 220 |   \node (2) [below=20mm] at (0) {\LARGE\bf source};
 | 
| 221 |   \node (3) [right=40mm] at (2) {\LARGE\bf binary};
 | |
| 222 | \draw [->,line width=1mm] (2) -- (3); | |
| 223 | \end{tikzpicture}
 | |
| 224 | \end{bubble}
 | |
| 225 | ||
| 226 | \end{textblock}}
 | |
| 227 | \only<11>{
 | |
| 228 | \begin{textblock}{6}(1,3)
 | |
| 229 |   \begin{bubble}[11cm]
 | |
| 230 |     Compiler explorer for Java: \url{https://javap.yawk.at} 
 | |
| 231 |   \begin{tikzpicture}[]
 | |
| 232 |   \node (0) at (-2.3,0) {\includegraphics[scale=0.4]{pics/jsource.png}};
 | |
| 233 |   \node (1) [right=35mm] at (0) {\includegraphics[scale=0.4]{pics/jassmbl.png}}; 
 | |
| 234 | \draw [->,line width=4mm, red] (0) -- (1); | |
| 235 |   \node (2) [below=20mm] at (0) {\LARGE\bf source};
 | |
| 236 |   \node (3) [right=40mm] at (2) {\LARGE\bf byte code};
 | |
| 744 | 237 | \draw [->,line width=1mm] (2) -- (3); | 
| 238 | \end{tikzpicture}
 | |
| 239 | \end{bubble}
 | |
| 240 | \end{textblock}}
 | |
| 241 | ||
| 242 | ||
| 243 | \end{frame}
 | |
| 244 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
| 245 | ||
| 246 | ||
| 247 | ||
| 248 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
| 559 | 249 | \begin{frame}[t]
 | 
| 250 | \frametitle{Why Study Compilers?}
 | |
| 0 | 251 | |
| 743 | 252 | |
| 253 | John Regehr {\small(Univ.~Utah, LLVM compiler hacker)}
 | |
| 254 | \here{https://blog.regehr.org/archives/1419}
 | |
| 255 | \smallskip\\ | |
| 255 
96a99237fa42
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
254diff
changeset | 256 | |
| 559 | 257 | \begin{bubble}[10.5cm]
 | 
| 258 |   \bf ``\ldots{}It’s effectively a perpetual
 | |
| 259 | employment act for solid compiler hackers.'' | |
| 260 | \end{bubble}
 | |
| 0 | 261 | |
| 559 | 262 | \onslide<1->{
 | 
| 263 | \only<2>{
 | |
| 264 | \begin{itemize}
 | |
| 265 | \item {\bf Hardware is getting weirder
 | |
| 631 | 266 | rather than getting clocked faster.} | 
| 0 | 267 | |
| 559 | 268 | \begin{itemize}
 | 
| 631 | 269 | \item[] ``Almost all processors are multicores nowadays and it looks | 
| 270 | like there is increasing asymmetry in resources across cores. | |
| 271 | Processors come with vector units, crypto accelerators etc. We have | |
| 272 | DSPs, GPUs, ARM big.little, and Xeon Phi. This is only scratching the | |
| 273 | surface.'' | |
| 559 | 274 | \end{itemize}  
 | 
| 275 | \end{itemize}}
 | |
| 255 
96a99237fa42
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
254diff
changeset | 276 | \only<3>{
 | 
| 559 | 277 | \begin{itemize}
 | 
| 278 | \item {\bf We’re getting tired of low-level languages and
 | |
| 631 | 279 | their associated security disasters.} | 
| 559 | 280 | |
| 281 | \begin{itemize}
 | |
| 631 | 282 | \item [] ``We want to write new code, to whatever extent possible, in | 
| 283 | safer, higher-level languages. Compilers are caught right in the | |
| 284 | middle of these opposing trends: one of their main jobs is to help | |
| 285 | bridge the large and growing gap between increasingly high-level | |
| 286 | languages and increasingly wacky platforms.'' | |
| 559 | 287 | \end{itemize}  
 | 
| 288 | \end{itemize}}}
 | |
| 1 | 289 | |
| 253 
75c469893514
added coursework
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
252diff
changeset | 290 | \end{frame}
 | 
| 0 | 291 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | 
| 1 | 292 | |
| 631 | 293 | |
| 294 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
| 295 | \begin{frame}[c]
 | |
| 744 | 296 | \frametitle{Why Bother with Compilers?}
 | 
| 631 | 297 | |
| 745 | 298 | \textbf{Boeing 777's}: First flight in 1994. They want to achieve
 | 
| 299 | triple redundancy for potential hardware faults. | |
| 300 | \here{http://www.citemaster.net/get/db3a81c6-548e-11e5-9d2e-00163e009cc7/R8.pdf}\bigskip
 | |
| 631 | 301 | |
| 302 | They compile 1 Ada program to\medskip | |
| 303 | ||
| 304 | \begin{itemize}
 | |
| 305 | \item Intel 80486 | |
| 306 | \item Motorola 68040 (old Macintosh's) | |
| 307 | \item AMD 29050 (RISC chips used often in laser printers) | |
| 308 | \end{itemize}\medskip\medskip
 | |
| 309 | ||
| 310 | using 3 independent compilers.\bigskip\pause | |
| 311 | ||
| 312 | \small Airbus uses C and static analysers. Recently started using CompCert. | |
| 745 | 313 | |
| 314 | \only<1->{%
 | |
| 315 | \begin{textblock}{6}(8,4.5)
 | |
| 316 | \includegraphics[scale=0.28]{../pics/777.png}
 | |
| 317 | \end{textblock}}
 | |
| 318 | ||
| 631 | 319 | \end{frame}
 | 
| 756 | 320 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | 
| 321 | ||
| 322 | ||
| 323 | ||
| 324 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
| 325 | \begin{frame}[c]
 | |
| 326 | \frametitle{What Do Compilers Do?}
 | |
| 327 | ||
| 328 | Remember BF*** from PEP? | |
| 329 | ||
| 330 | \begin{center}
 | |
| 331 | \begin{tabular}{rcl}
 | |
| 332 | \bl{\texttt{>}} & $\Rightarrow$ & move one cell right\\
 | |
| 333 | \bl{\texttt{<}} & $\Rightarrow$ & move one cell left\\
 | |
| 334 | \bl{\texttt{+}} & $\Rightarrow$ & increase cell by one\\
 | |
| 335 | \bl{\texttt{-}} & $\Rightarrow$ & decrease cell by one\\
 | |
| 336 | \bl{\texttt{.}} & $\Rightarrow$ & print current cell\\
 | |
| 337 | \bl{\texttt{,}} & $\Rightarrow$ & input current cell\\
 | |
| 338 | \bl{\texttt{[}} & $\Rightarrow$ & loop begin\\
 | |
| 339 | \bl{\texttt{]}} & $\Rightarrow$ & loop end\medskip\\
 | |
| 340 | & $\Rightarrow$ & everything else is a comment\\ | |
| 341 | \end{tabular}  
 | |
| 342 | \end{center}  
 | |
| 343 | ||
| 344 | \end{frame}
 | |
| 345 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
| 346 | ||
| 347 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
| 348 | \begin{frame}[c]
 | |
| 349 |   \frametitle{A ``Compiler'' for BF*** to C}
 | |
| 350 | ||
| 351 |   \begin{center}
 | |
| 352 |   \begin{tabular}{rcl}
 | |
| 353 |   \bl{\texttt{>}} & $\Rightarrow$ & \texttt{ptr++}\\
 | |
| 354 |   \bl{\texttt{<}} & $\Rightarrow$ & \texttt{ptr--}\\
 | |
| 355 |   \bl{\texttt{+}} & $\Rightarrow$ & \texttt{(*ptr)++}\\
 | |
| 356 |   \bl{\texttt{-}} & $\Rightarrow$ & \texttt{(*ptr)--}\\
 | |
| 357 |   \bl{\texttt{.}} & $\Rightarrow$ & \texttt{putchar(*ptr)}\\
 | |
| 358 |   \bl{\texttt{,}} & $\Rightarrow$ & \texttt{*ptr = getchar()}\\
 | |
| 359 |   \bl{\texttt{[}} & $\Rightarrow$ & \texttt{while(*ptr)\{}\\
 | |
| 360 |   \bl{\texttt{]}} & $\Rightarrow$ & \texttt{\}}\medskip\\
 | |
| 361 | & $\Rightarrow$ & ignore everything else\\ | |
| 362 |   \end{tabular}  
 | |
| 363 |   \end{center}\bigskip  
 | |
| 364 | ||
| 365 |   \texttt{char field[30000]\\ char *ptr = \&field[15000]}
 | |
| 366 | ||
| 367 | \end{frame}
 | |
| 368 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
| 369 | ||
| 370 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
| 371 | \begin{frame}[c]
 | |
| 757 | 372 |   \frametitle{Another~``Compiler''~for~BF~to~C}
 | 
| 756 | 373 | |
| 374 |   \begin{center}
 | |
| 375 |   \begin{tabular}{rcl}
 | |
| 376 |   \bl{\texttt{>\ldots>}} & $\Rightarrow$ & \texttt{ptr += n}\\
 | |
| 377 |   \bl{\texttt{<\ldots<}} & $\Rightarrow$ & \texttt{ptr -= n}\\
 | |
| 378 |   \bl{\texttt{+\ldots+}} & $\Rightarrow$ & \texttt{(*ptr) += n}\\
 | |
| 379 |   \bl{\texttt{-\ldots-}} & $\Rightarrow$ & \texttt{(*ptr) -= n}\\
 | |
| 380 |   \bl{\texttt{.}} & $\Rightarrow$ & \texttt{putchar(*ptr)}\\
 | |
| 381 |   \bl{\texttt{,}} & $\Rightarrow$ & \texttt{*ptr = getchar()}\\
 | |
| 382 |   \bl{\texttt{[}} & $\Rightarrow$ & \texttt{while(*ptr)\{}\\
 | |
| 383 |   \bl{\texttt{]}} & $\Rightarrow$ & \texttt{\}}\medskip\\
 | |
| 384 | & $\Rightarrow$ & ignore everything else\\ | |
| 385 |   \end{tabular}  
 | |
| 386 |   \end{center}\bigskip  
 | |
| 387 | ||
| 388 |   \texttt{char field[30000]\\ char *ptr = \&field[15000]}
 | |
| 389 | ||
| 390 | \end{frame}
 | |
| 391 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
| 757 | 392 | |
| 756 | 393 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | 
| 394 | \begin{frame}[t]
 | |
| 395 | \frametitle{A Brief Compiler History}
 | |
| 396 | ||
| 397 | \bigskip | |
| 398 | \begin{itemize}
 | |
| 399 | \item Turing Machines, 1936 (a tape as memory) | |
| 400 | \item Regular Expressions, 1956\\ | |
| 401 | \item The first compiler for COBOL, 1957\\ (Grace Hopper)\medskip | |
| 402 | \item But surprisingly research papers are still published nowadays\\ | |
| 403 | \item ``Parsing: The Solved Problem That Isn't'' | |
| 404 |   \here{https://tratt.net/laurie/blog/entries/parsing_the_solved_problem_that_isnt.html}
 | |
| 405 | \end{itemize}
 | |
| 406 | ||
| 407 | ||
| 408 | \begin{textblock}{8.5}(5,7.6)
 | |
| 409 | \begin{flushright}
 | |
| 410 | \includegraphics[scale=0.3]{pics/hopper.jpg}\\
 | |
| 411 | \footnotesize\textcolor{gray}{Grace Hopper}\smallskip\\
 | |
| 412 | ||
| 413 | {\small\textcolor{gray}{(she made it to David Letterman's Tonight Show
 | |
| 414 |  \here{https://youtu.be/3N_ywhx6_K0?t=31})}}
 | |
| 415 | \end{flushright}
 | |
| 416 | \end{textblock}
 | |
| 417 | ||
| 418 | \end{frame}
 | |
| 419 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
| 420 | ||
| 421 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
| 422 | \begin{frame}[c]
 | |
| 757 | 423 | \frametitle{Some Housekeeping}
 | 
| 424 | ||
| 425 | \textbf{Exams will be online:}\bigskip
 | |
| 426 | ||
| 427 | \begin{itemize}
 | |
| 428 | \item final exam in January (30\%) | |
| 429 | \item mid-term shortly after Reading Week (10\%)\bigskip | |
| 430 | ||
| 431 | \item weekly engagement (10\%) | |
| 432 | \end{itemize}\bigskip\bigskip\pause
 | |
| 433 | ||
| 434 | ||
| 435 | \textbf{Weekly Homework (optional):}
 | |
| 436 | \begin{itemize}
 | |
| 437 | \item uploaded on KEATS, send answers via email, responded individually | |
| 438 | \item \alert{\bf all} questions in the exam and mid-term will be from the HW!!
 | |
| 439 | \end{itemize}  
 | |
| 440 | ||
| 441 | \end{frame}
 | |
| 442 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
| 443 | ||
| 444 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
| 445 | \begin{frame}[c]
 | |
| 446 | \frametitle{Some Housekeeping}
 | |
| 447 | ||
| 448 | \textbf{Coursework (5 accounting for 45\%):}\bigskip
 | |
| 449 | ||
| 450 | \begin{itemize}
 | |
| 451 | \item matcher (5\%) | |
| 452 | \item lexer (8\%) | |
| 453 | \item parser / interpreter (10\%) | |
| 454 | \item JVM compiler (10\%) | |
| 455 | \item LLVM compiler (12\%) | |
| 456 | \end{itemize}\bigskip\pause
 | |
| 457 | ||
| 458 | you can use any programming language you like (Haskell, Rust)\\\pause | |
| 459 | you can use any code I showed you and uploaded to KEATS\ldots\textbf{BUT NOTHING ELSE!}\pause
 | |
| 460 | ||
| 461 | \end{frame}
 | |
| 462 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
| 463 | ||
| 464 | ||
| 465 | ||
| 466 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
| 467 | \begin{frame}[c]
 | |
| 468 | \frametitle{Lectures 1 - 5}
 | |
| 469 | ||
| 470 | transforming strings into structured data\\[10mm] | |
| 471 | ||
| 472 | {\LARGE\bf Lexing} {\hfill{}based on regular expressions}\medskip\\
 | |
| 473 | \hspace{5mm}(recognising ``words'')\\[6mm]
 | |
| 474 | ||
| 475 | {\LARGE\bf Parsing}\medskip\\
 | |
| 476 | \hspace{5mm}(recognising ``sentences'')
 | |
| 477 | ||
| 478 | \begin{textblock}{1}(10,9.1)
 | |
| 479 | \begin{tabular}{c}
 | |
| 480 | \includegraphics[scale=0.1]{../pics/rosetta.jpg}\\[-2mm]
 | |
| 481 | \footnotesize Stone of Rosetta | |
| 482 | \end{tabular}
 | |
| 483 | \end{textblock}
 | |
| 484 | ||
| 485 | \end{frame}
 | |
| 486 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
| 487 | ||
| 488 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
| 489 | \begin{frame}[c]
 | |
| 756 | 490 | \frametitle{Lectures 1 - 5}
 | 
| 491 | ||
| 492 | transforming strings into structured data\\[10mm] | |
| 493 | ||
| 494 | {\LARGE\bf Lexing} {\hfill{}based on regular expressions}\medskip\\
 | |
| 495 | \hspace{5mm}(recognising ``words'')\\[6mm]
 | |
| 496 | ||
| 497 | {\LARGE\bf Parsing}\medskip\\
 | |
| 498 | \hspace{5mm}(recognising ``sentences'')
 | |
| 499 | ||
| 500 | \begin{textblock}{1}(10,9.1)
 | |
| 501 | \begin{tabular}{c}
 | |
| 502 | \includegraphics[scale=0.1]{../pics/rosetta.jpg}\\[-2mm]
 | |
| 503 | \footnotesize Stone of Rosetta | |
| 504 | \end{tabular}
 | |
| 505 | \end{textblock}
 | |
| 506 | ||
| 507 | \end{frame}
 | |
| 508 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
| 509 | ||
| 510 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
| 511 | \begin{frame}[c]
 | |
| 512 |   \frametitle{Lectures 5 - 10}
 | |
| 513 | ||
| 514 | code generation for a small imperative and a small functional language\\[10mm] | |
| 515 | ||
| 516 |   {\LARGE\bf Interpreters}\medskip\\
 | |
| 517 |   \hspace{5mm}(directly runs a program)\\[6mm]
 | |
| 518 | ||
| 519 |   {\LARGE\bf Compilers}\medskip\\
 | |
| 520 |   \hspace{5mm}(generate JVM code and LLVM-IR code)
 | |
| 521 | ||
| 522 |   \begin{textblock}{1}(8.8,8.1)
 | |
| 523 |   \begin{tabular}{c@{}c}
 | |
| 524 |     \includegraphics[scale=0.4]{../pics/javaduke.png} &
 | |
| 525 |     \includegraphics[scale=0.23]{../pics/llvmlogo.png}
 | |
| 526 |   \end{tabular}
 | |
| 527 |   \end{textblock}
 | |
| 528 | ||
| 529 |   \end{frame}
 | |
| 757 | 530 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | 
| 756 | 531 | |
| 532 | ||
| 533 | ||
| 534 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
| 535 | \begin{frame}[t]
 | |
| 757 | 536 | \frametitle{Familiar Regular Expresssions}
 | 
| 756 | 537 | \small | 
| 538 | \begin{center}
 | |
| 539 | \texttt{[a-z0-9\_$\backslash{}$.-]+ @ [a-z0-9$\backslash{}$.-]+ . [a-z$\backslash{}$.]\{2,6\}}
 | |
| 540 | \end{center}\smallskip
 | |
| 541 | ||
| 542 | \begin{center}
 | |
| 543 | \begin{tabular}{@{}lp{8.5cm}@{}}
 | |
| 544 | \pcode{re*} & matches 0 or more times\\
 | |
| 545 | \pcode{re+} & matches 1 or more times\\
 | |
| 546 | \pcode{re?} & matches 0 or 1 times\\
 | |
| 547 | \pcode{re\{n\}}	& matches exactly \pcode{n} number of times\\
 | |
| 548 | \pcode{re\{n,m\}} & matches at least \pcode{n} and at most {\tt m} times\\
 | |
| 549 | \pcode{[...]} & matches any single character inside the brackets\\
 | |
| 550 | \pcode{[^...]} & matches any single character not inside the 
 | |
| 551 | brackets\\ | |
| 552 | \pcode{a-z A-Z} & character ranges\\
 | |
| 553 | \pcode{\\d} & matches digits; equivalent to \pcode{[0-9]}\\
 | |
| 554 | \pcode{.} & matches every character except newline\\
 | |
| 555 | \pcode{(re)}	& groups regular expressions and remembers 
 | |
| 556 | the matched text | |
| 557 | \end{tabular}
 | |
| 558 | \end{center}
 | |
| 559 | ||
| 757 | 560 | \end{frame}
 | 
| 561 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
| 562 | ||
| 563 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
| 564 | \begin{frame}[c]
 | |
| 565 | \frametitle{Some ``innocent'' examples}
 | |
| 566 | ||
| 567 | Let's try two examples | |
| 568 | ||
| 569 | \begin{center}
 | |
| 570 |   \bl{\texttt{(a*)*b}}
 | |
| 571 |   \hspace{2cm}
 | |
| 572 |   \bl{\texttt{[a?]\{n\}[a]\{n\}}}
 | |
| 573 | \end{center}\bigskip\pause  
 | |
| 574 | ||
| 575 | and match them with strings of the form | |
| 576 | ||
| 577 | \begin{center}
 | |
| 578 |   \bl{\texttt{a}},
 | |
| 579 |   \bl{\texttt{aa}},
 | |
| 580 |   \bl{\texttt{aaa}},
 | |
| 581 |   \bl{\texttt{aaaa}},
 | |
| 582 |   \bl{\texttt{aaaaa}},
 | |
| 583 |   \bl{$\underbrace{\texttt{a}...\texttt{a}}_n$}  
 | |
| 584 | \end{center}  
 | |
| 756 | 585 | |
| 586 | \end{frame}
 | |
| 587 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
| 588 | ||
| 631 | 589 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | 
| 255 
96a99237fa42
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
254diff
changeset | 590 | \begin{frame}[c]
 | 
| 745 | 591 | \frametitle{Why Bother with Regexes?}
 | 
| 255 
96a99237fa42
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
254diff
changeset | 592 | |
| 745 | 593 | \begin{columns}[t,onlytextwidth]
 | 
| 594 | \begin{column}{1.8cm}
 | |
| 595 | \mbox{}   
 | |
| 596 | \end{column}    
 | |
| 597 | \begin{column}{.5\textwidth}
 | |
| 598 | \small{}Ruby, Python, Java 8\medskip\\
 | |
| 428 
a47c4227a0c6
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
334diff
changeset | 599 | \begin{tikzpicture}\footnotesize
 | 
| 
a47c4227a0c6
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
334diff
changeset | 600 | \begin{axis}[
 | 
| 
a47c4227a0c6
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
334diff
changeset | 601 |     xlabel={$n$},
 | 
| 
a47c4227a0c6
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
334diff
changeset | 602 |     x label style={at={(1.05,0.0)}},
 | 
| 
a47c4227a0c6
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
334diff
changeset | 603 |     ylabel={time in secs},
 | 
| 
a47c4227a0c6
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
334diff
changeset | 604 | enlargelimits=false, | 
| 
a47c4227a0c6
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
334diff
changeset | 605 |     xtick={0,5,...,30},
 | 
| 
a47c4227a0c6
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
334diff
changeset | 606 | xmax=33, | 
| 
a47c4227a0c6
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
334diff
changeset | 607 | ymax=35, | 
| 
a47c4227a0c6
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
334diff
changeset | 608 |     ytick={0,5,...,30},
 | 
| 
a47c4227a0c6
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
334diff
changeset | 609 | scaled ticks=false, | 
| 
a47c4227a0c6
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
334diff
changeset | 610 | axis lines=left, | 
| 745 | 611 | width=\textwidth, | 
| 428 
a47c4227a0c6
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
334diff
changeset | 612 | height=4cm, | 
| 
a47c4227a0c6
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
334diff
changeset | 613 |     legend entries={Python,Ruby},  
 | 
| 
a47c4227a0c6
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
334diff
changeset | 614 | legend pos=north west, | 
| 
a47c4227a0c6
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
334diff
changeset | 615 | legend cell align=left] | 
| 559 | 616 | \addplot[blue,mark=*, mark options={fill=white}] table {re-python.data};
 | 
| 617 | \addplot[brown,mark=triangle*, mark options={fill=white}] table {re-ruby.data};
 | |
| 428 
a47c4227a0c6
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
334diff
changeset | 618 | \end{axis}
 | 
| 
a47c4227a0c6
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
334diff
changeset | 619 | \end{tikzpicture}
 | 
| 
a47c4227a0c6
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
334diff
changeset | 620 | \begin{tikzpicture}\footnotesize
 | 
| 
a47c4227a0c6
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
334diff
changeset | 621 | \begin{axis}[
 | 
| 
a47c4227a0c6
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
334diff
changeset | 622 |     xlabel={$n$},
 | 
| 
a47c4227a0c6
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
334diff
changeset | 623 |     x label style={at={(1.05,0.0)}},
 | 
| 
a47c4227a0c6
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
334diff
changeset | 624 |     ylabel={time in secs},
 | 
| 
a47c4227a0c6
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
334diff
changeset | 625 | enlargelimits=false, | 
| 
a47c4227a0c6
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
334diff
changeset | 626 |     xtick={0,5,...,30},
 | 
| 
a47c4227a0c6
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
334diff
changeset | 627 | xmax=33, | 
| 
a47c4227a0c6
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
334diff
changeset | 628 | ymax=35, | 
| 
a47c4227a0c6
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
334diff
changeset | 629 |     ytick={0,5,...,30},
 | 
| 
a47c4227a0c6
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
334diff
changeset | 630 | scaled ticks=false, | 
| 
a47c4227a0c6
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
334diff
changeset | 631 | axis lines=left, | 
| 745 | 632 | width=\textwidth, | 
| 428 
a47c4227a0c6
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
334diff
changeset | 633 | height=4cm, | 
| 631 | 634 |     legend entries={Python, Java 8, JavaScript},  
 | 
| 428 
a47c4227a0c6
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
334diff
changeset | 635 | legend pos=north west, | 
| 
a47c4227a0c6
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
334diff
changeset | 636 | legend cell align=left] | 
| 559 | 637 | \addplot[blue,mark=*, mark options={fill=white}] table {re-python2.data};   
 | 
| 428 
a47c4227a0c6
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
334diff
changeset | 638 | \addplot[cyan,mark=*, mark options={fill=white}] table {re-java.data};
 | 
| 631 | 639 | \addplot[red,mark=*, mark options={fill=white}] table {re-js.data};
 | 
| 428 
a47c4227a0c6
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
334diff
changeset | 640 | \end{axis}
 | 
| 
a47c4227a0c6
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
334diff
changeset | 641 | \end{tikzpicture}
 | 
| 745 | 642 | % | 
| 428 
a47c4227a0c6
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
334diff
changeset | 643 | \end{column}
 | 
| 745 | 644 | \begin{column}{.5\textwidth}
 | 
| 645 | \small{}Us (after next lecture)\medskip\\
 | |
| 428 
a47c4227a0c6
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
334diff
changeset | 646 | \begin{tikzpicture}\footnotesize
 | 
| 
a47c4227a0c6
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
334diff
changeset | 647 | \begin{axis}[
 | 
| 
a47c4227a0c6
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
334diff
changeset | 648 |     xlabel={$n$},
 | 
| 
a47c4227a0c6
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
334diff
changeset | 649 |     x label style={at={(1.07,0.0)}},
 | 
| 
a47c4227a0c6
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
334diff
changeset | 650 |     ylabel={time in secs},
 | 
| 
a47c4227a0c6
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
334diff
changeset | 651 | enlargelimits=false, | 
| 442 
84d6714840c9
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
437diff
changeset | 652 |     xtick={0,5000,...,10000},
 | 
| 
84d6714840c9
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
437diff
changeset | 653 | xmax=11000, | 
| 428 
a47c4227a0c6
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
334diff
changeset | 654 | ymax=35, | 
| 
a47c4227a0c6
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
334diff
changeset | 655 |     ytick={0,5,...,30},
 | 
| 
a47c4227a0c6
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
334diff
changeset | 656 | scaled ticks=false, | 
| 
a47c4227a0c6
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
334diff
changeset | 657 | axis lines=left, | 
| 745 | 658 | width=\textwidth, | 
| 428 
a47c4227a0c6
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
334diff
changeset | 659 | height=4cm] | 
| 437 
fe387fcbf2ee
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
428diff
changeset | 660 | \addplot[green,mark=square*,mark options={fill=white}] table {re2.data};
 | 
| 428 
a47c4227a0c6
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
334diff
changeset | 661 | \addplot[black,mark=square*,mark options={fill=white}] table {re3.data};
 | 
| 
a47c4227a0c6
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
334diff
changeset | 662 | \end{axis}
 | 
| 
a47c4227a0c6
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
334diff
changeset | 663 | \end{tikzpicture}
 | 
| 
a47c4227a0c6
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
334diff
changeset | 664 | \begin{tikzpicture}\footnotesize
 | 
| 
a47c4227a0c6
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
334diff
changeset | 665 | \begin{axis}[
 | 
| 
a47c4227a0c6
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
334diff
changeset | 666 |     xlabel={$n$},
 | 
| 
a47c4227a0c6
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
334diff
changeset | 667 |     x label style={at={(1.07,0.0)}},
 | 
| 
a47c4227a0c6
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
334diff
changeset | 668 |     ylabel={time in secs},
 | 
| 
a47c4227a0c6
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
334diff
changeset | 669 | enlargelimits=false, | 
| 
a47c4227a0c6
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
334diff
changeset | 670 | ymax=35, | 
| 
a47c4227a0c6
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
334diff
changeset | 671 |     ytick={0,5,...,30},
 | 
| 
a47c4227a0c6
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
334diff
changeset | 672 | scaled ticks=false, | 
| 
a47c4227a0c6
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
334diff
changeset | 673 | axis lines=left, | 
| 745 | 674 | width=\textwidth, | 
| 428 
a47c4227a0c6
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
334diff
changeset | 675 | height=4cm] | 
| 
a47c4227a0c6
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
334diff
changeset | 676 | \addplot[black,mark=square*,mark options={fill=white}] table {re3a.data};
 | 
| 
a47c4227a0c6
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
334diff
changeset | 677 | \end{axis}
 | 
| 255 
96a99237fa42
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
254diff
changeset | 678 | \end{tikzpicture}
 | 
| 
96a99237fa42
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
254diff
changeset | 679 | \end{column}
 | 
| 745 | 680 | \end{columns}
 | 
| 681 | \medskip | |
| 682 | ||
| 683 | \begin{textblock}{3}(-0.1,3.3)
 | |
| 684 | \small\hfill\bl{\texttt{[a?]\{n\}[a]\{n\}}}:
 | |
| 685 | \end{textblock}
 | |
| 255 
96a99237fa42
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
254diff
changeset | 686 | |
| 745 | 687 | \begin{textblock}{3}(-0.1,8.7)  
 | 
| 688 | \small\hfill\bl{\texttt{(a*)*b}}:
 | |
| 689 | \end{textblock}
 | |
| 690 | ||
| 691 | \begin{textblock}{3}(0.3,13)
 | |
| 692 | \small{}matching with strings
 | |
| 693 | \bl{$\underbrace{\texttt{a}...\texttt{a}}_n$}  
 | |
| 694 | \end{textblock}
 | |
| 695 | ||
| 510 | 696 | \end{frame} 
 | 
| 255 
96a99237fa42
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
254diff
changeset | 697 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | 
| 631 | 698 | |
| 699 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
| 700 | \begin{frame}[c,fragile]
 | |
| 701 |   \frametitle{Incidents}
 | |
| 702 | ||
| 703 |   \begin{itemize}
 | |
| 704 |   \item a global outage on 2 July 2019 at \textbf{Cloudflare} 
 | |
| 705 | (first one for six years)\medskip | |
| 706 | ||
| 707 |   \begin{center}\small\color{blue}
 | |
| 708 |   \begin{verbatim}  
 | |
| 709 | (?:(?:\"|'|\]|\}|\\|\d|(?:nan|infinity|true|false| | |
| 710 | null|undefined|symbol|math)|\`|\-|\+)+[)]*;?((?:\s | |
| 711 |   |-|~|!|{}|\|\||\+)*.*(?:.*=.*)))  
 | |
| 712 |   \end{verbatim}
 | |
| 713 |   \end{center}\bigskip\bigskip\bigskip\bigskip\bigskip\bigskip\bigskip    
 | |
| 714 | ||
| 715 |   \item on 20 July 2016 the \textbf{Stack Exchange} webpage went down
 | |
| 745 | 716 | because of an evil regular expression | 
| 717 |     \here{https://stackstatus.net/post/147710624694/outage-postmortem-july-20-2016}    
 | |
| 631 | 718 |   \end{itemize}
 | 
| 719 | ||
| 745 | 720 |   \begin{textblock}{6}(6,7.6)
 | 
| 728 | 721 |     \includegraphics[scale=0.14]{../pics/cloudflare.png}\\
 | 
| 631 | 722 | \footnotesize | 
| 745 | 723 | It serves more web traffic than Twitter, Amazon, Apple, | 
| 724 | Instagram, Bing \& Wikipedia combined. | |
| 725 |     \here{https://blog.cloudflare.com/details-of-the-cloudflare-outage-on-july-2-2019/}
 | |
| 631 | 726 |     \end{textblock}
 | 
| 727 | ||
| 728 |   \end{frame}
 | |
| 729 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
| 730 | ||
| 560 | 731 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | 
| 732 | \begin{frame}[c]
 | |
| 733 | \frametitle{Evil Regular Expressions}
 | |
| 734 | ||
| 735 | \begin{itemize}
 | |
| 736 | \item \alert{R}egular \alert{e}xpression \alert{D}enial \alert{o}f \alert{S}ervice (ReDoS)\medskip
 | |
| 745 | 737 | \item Some evil regular expressions:\medskip | 
| 560 | 738 | \begin{itemize}
 | 
| 745 | 739 | \item \bl{\texttt{[a?]\{n\}\;[a]\{n\}}}
 | 
| 740 | \item \bl{\texttt{(a*)*\;b}}  
 | |
| 741 | \item \bl{\texttt{([a-z]+)*}} 
 | |
| 742 | \item \bl{\texttt{(a + aa)*}}
 | |
| 743 | \item \bl{\texttt{(a + a?)*}}
 | |
| 560 | 744 | \end{itemize}
 | 
| 745 | ||
| 746 | \item sometimes also called \alert{catastrophic backtracking}
 | |
| 747 | \item this is a problem for \alert{N}etwork \alert{I}ntrusion
 | |
| 631 | 748 |   \alert{D}etection systems, Cloudflare, StackExchange, Atom editor
 | 
| 560 | 749 | \item \url{https://vimeo.com/112065252}  
 | 
| 750 | \end{itemize}
 | |
| 751 | ||
| 752 | \end{frame}
 | |
| 753 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
| 428 
a47c4227a0c6
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
334diff
changeset | 754 | |
| 255 
96a99237fa42
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
254diff
changeset | 755 | |
| 
96a99237fa42
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
254diff
changeset | 756 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | 
| 631 | 757 | %\begin{frame}[c]
 | 
| 758 | %\frametitle{Today}
 | |
| 759 | % | |
| 760 | %\begin{itemize}
 | |
| 761 | %\item While the ultimate goal is to implement a small compiler for the JVM | |
| 762 | % \ldots\bigskip | |
| 763 | %\end{itemize}
 | |
| 764 | % | |
| 765 | %Let's start with: | |
| 766 | % | |
| 767 | %\begin{itemize}
 | |
| 768 | %\item a web-crawler | |
| 769 | %\item an email harvester | |
| 559 | 770 | %\item \textcolor{gray}{(a web-scraper)}
 | 
| 631 | 771 | %\end{itemize}
 | 
| 772 | % | |
| 773 | %\end{frame}
 | |
| 255 
96a99237fa42
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
254diff
changeset | 774 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | 
| 0 | 775 | |
| 2 | 776 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | 
| 631 | 777 | %\begin{frame}[t]
 | 
| 778 | %\frametitle{A Web-Crawler}
 | |
| 779 | % | |
| 780 | %\mbox{}\\[10mm]
 | |
| 781 | % | |
| 782 | %\begin{enumerate}
 | |
| 783 | %\item given an URL, read the corresponding webpage | |
| 784 | %\item extract all links from it | |
| 785 | %\item call the web-crawler again for all these links | |
| 786 | %\end{enumerate}
 | |
| 787 | % | |
| 788 | %\end{frame}
 | |
| 2 | 789 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | 
| 790 | ||
| 791 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
| 631 | 792 | %\begin{frame}[t]
 | 
| 793 | %\frametitle{A Web-Crawler}
 | |
| 794 | % | |
| 795 | %\mbox{}\\[10mm]
 | |
| 796 | % | |
| 797 | % | |
| 798 | %\begin{enumerate}
 | |
| 799 | %\item given an URL, read the corresponding webpage | |
| 800 | %\item if not possible print, out a problem | |
| 801 | %\item if possible, extract all links from it | |
| 802 | %\item call the web-crawler again for all these links | |
| 803 | %\end{enumerate}\bigskip\pause
 | |
| 804 | % | |
| 805 | %\small (we need a bound for the number of recursive calls) | |
| 806 | % | |
| 807 | %\small (the purpose is to check all links on my own webpage) | |
| 808 | %\end{frame}
 | |
| 2 | 809 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | 
| 810 | ||
| 255 
96a99237fa42
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
254diff
changeset | 811 | |
| 
96a99237fa42
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
254diff
changeset | 812 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | 
| 631 | 813 | %\begin{frame}[c]
 | 
| 814 | % | |
| 815 | %\begin{textblock}{1}(2,5)
 | |
| 816 | %\begin{tabular}{c}
 | |
| 817 | %\includegraphics[scale=0.15]{pics/servers.png}\\[-2mm]
 | |
| 818 | %\small Server | |
| 819 | %\end{tabular}
 | |
| 820 | %\end{textblock}
 | |
| 821 | % | |
| 822 | %\begin{textblock}{1}(5.6,4)
 | |
| 823 | %  \begin{tikzpicture}[scale=1.1]
 | |
| 824 | %  \draw[white] (0,1) node (X) {};
 | |
| 825 | %  \draw[white] (2,1) node (Y) {};
 | |
| 826 | %   \draw[white] (0,0) node (X1) {};
 | |
| 827 | %  \draw[white] (2,0) node (Y1) {};
 | |
| 828 | %   \draw[white] (0,-1) node (X2) {};
 | |
| 829 | %  \draw[white] (2,-1) node (Y2) {};
 | |
| 830 | % \draw[red, <-, line width = 2mm] (X) -- (Y); | |
| 831 | %  \node [inner sep=5pt,label=above:\textcolor{black}{GET request}] at ($ (X)!.5!(Y) $) {};
 | |
| 832 | % \draw[red, ->, line width = 2mm] (X1) -- (Y1); | |
| 833 | %  \node [inner sep=5pt,label=above:\textcolor{black}{webpage}] at ($ (X1)!.5!(Y1) $) {};
 | |
| 834 | % \draw[red, <-, line width = 2mm] (X2) -- (Y2); | |
| 835 | %  \node [inner sep=7pt,label=above:\textcolor{black}{POST data}] at ($ (X2)!.5!(Y2) $) {};
 | |
| 836 | %  \end{tikzpicture}
 | |
| 837 | %\end{textblock}
 | |
| 838 | % | |
| 839 | % | |
| 840 | %\begin{textblock}{1}(9,5.5)
 | |
| 841 | %\begin{tabular}{c}
 | |
| 842 | %\includegraphics[scale=0.15]{pics/laptop.png}\\[-2mm]
 | |
| 843 | %\small Browser | |
| 844 | %\end{tabular}
 | |
| 845 | %\end{textblock}
 | |
| 846 | %\end{frame}
 | |
| 847 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
| 255 
96a99237fa42
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
254diff
changeset | 848 | |
| 
96a99237fa42
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
254diff
changeset | 849 | |
| 
96a99237fa42
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
254diff
changeset | 850 | |
| 0 | 851 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | 
| 631 | 852 | %\begin{frame}[c]
 | 
| 853 | %\frametitle{Scala}
 | |
| 854 | % | |
| 855 | %\small A simple Scala function for reading webpages: | |
| 856 | %\bigskip | |
| 857 | % | |
| 858 | %\footnotesize | |
| 859 | %\lstinputlisting{../progs/app0.scala}
 | |
| 860 | %\medskip\pause | |
| 861 | % | |
| 862 | %\lstinline{get_page("""https://nms.kcl.ac.uk/christian.urban/""")}
 | |
| 863 | %\bigskip\medskip\pause | |
| 864 | % | |
| 865 | % | |
| 866 | %\small A slightly more complicated version for handling errors: | |
| 867 | %\smallskip | |
| 868 | % | |
| 869 | %\footnotesize | |
| 870 | %\lstinputlisting[xleftmargin=-4mm]{../progs/app1.scala}
 | |
| 871 | % | |
| 872 | % | |
| 873 | %\end{frame}
 | |
| 0 | 874 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | 
| 875 | ||
| 98 
1f3d89fe9820
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
97diff
changeset | 876 | |
| 
1f3d89fe9820
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
97diff
changeset | 877 | |
| 
1f3d89fe9820
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
97diff
changeset | 878 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | 
| 757 | 879 | %\begin{frame}[t]
 | 
| 880 | %\frametitle{A Regular Expression}
 | |
| 881 | % | |
| 882 | %\begin{itemize}
 | |
| 883 | %\item \ldots{} is a pattern or template for specifying strings
 | |
| 884 | %\end{itemize}\bigskip
 | |
| 885 | % | |
| 886 | %\begin{center}  
 | |
| 887 | %\only<1>{\scode{"https?://[^"]*"}}%
 | |
| 888 | %\only<2>{\scode{""""https?://[^"]*"""".r}}
 | |
| 889 | %\end{center}\bigskip\bigskip
 | |
| 890 | % | |
| 891 | %matches for example\smallskip\\ | |
| 892 | %\hspace{2mm}\code{"http://www.foobar.com"}\\
 | |
| 893 | %\hspace{2mm}\code{"https://www.tls.org"}\smallskip\\
 | |
| 894 | % | |
| 895 | %but not\smallskip\\ | |
| 896 | %\hspace{2mm}\code{"http://www."foo"bar.com"}\\
 | |
| 897 | % | |
| 898 | %\end{frame}
 | |
| 3 | 899 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | 
| 900 | ||
| 901 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
| 632 | 902 | %\begin{frame}[c]
 | 
| 903 | %\frametitle{Finding Operations in Scala}
 | |
| 904 | % | |
| 905 | %{\bf\code{rexp.findAllIn(string)}}\medskip
 | |
| 906 | % | |
| 907 | %returns a list of all (sub)strings that match the | |
| 908 | %regular expression | |
| 909 | %\bigskip\bigskip | |
| 910 | % | |
| 911 | % | |
| 912 | %{\bf\code{rexp.findFirstIn(string)}}\medskip
 | |
| 913 | % | |
| 914 | %returns either | |
| 915 | % | |
| 916 | %\begin{itemize}
 | |
| 917 | %\item \code{None} if no (sub)string matches or 
 | |
| 918 | %\item \code{Some(s)} with the first (sub)string
 | |
| 919 | %\end{itemize}
 | |
| 920 | % | |
| 921 | %\end{frame}
 | |
| 0 | 922 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | 
| 923 | ||
| 924 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
| 631 | 925 | %\begin{frame}[c]
 | 
| 926 | % | |
| 927 | %\footnotesize | |
| 928 | %\lstinputlisting{../progs/app2.scala}
 | |
| 929 | % | |
| 930 | %\end{frame}
 | |
| 254 
dcd4688690ce
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
253diff
changeset | 931 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | 
| 0 | 932 | |
| 254 
dcd4688690ce
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
253diff
changeset | 933 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | 
| 631 | 934 | %\begin{frame}[c]
 | 
| 935 | % | |
| 936 | %\small | |
| 937 | %A version that only crawls links in ``my'' domain:\bigskip | |
| 938 | % | |
| 939 | %\footnotesize | |
| 940 | %\lstinputlisting{../progs/app3.scala}
 | |
| 941 | % | |
| 942 | %\end{frame}
 | |
| 0 | 943 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | 
| 944 | ||
| 945 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
| 631 | 946 | %\begin{frame}[c]
 | 
| 947 | %\lstset{xleftmargin=-4mm}
 | |
| 948 | %\small | |
| 949 | %A little email harvester: | |
| 950 | % | |
| 951 | %\footnotesize | |
| 952 | %\lstinputlisting{../progs/app4.scala}\bigskip
 | |
| 953 | % | |
| 954 | %\tiny | |
| 955 | %\url{http://net.tutsplus.com/tutorials/other/8-regular-expressions-you-should-know/}
 | |
| 956 | % | |
| 957 | %\end{frame}
 | |
| 3 | 958 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | 
| 959 | ||
| 960 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
| 14 | 961 | \begin{frame}[t]
 | 
| 757 | 962 | \frametitle{(Basic) Regular Expressions}
 | 
| 0 | 963 | |
| 330 
0806e45d873c
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
328diff
changeset | 964 | Their inductive definition: | 
| 
0806e45d873c
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
328diff
changeset | 965 | |
| 14 | 966 | |
| 330 
0806e45d873c
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
328diff
changeset | 967 | \begin{textblock}{6}(2,7.5)
 | 
| 
0806e45d873c
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
328diff
changeset | 968 |   \begin{tabular}{@ {}rrl@ {\hspace{13mm}}l}
 | 
| 512 | 969 |   \bl{$r$} & \bl{$::=$}  & \bl{$\ZERO$}  & nothing\\
 | 
| 428 
a47c4227a0c6
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
334diff
changeset | 970 |          & \bl{$\mid$} & \bl{$\ONE$}       & empty string / \pcode{""} / $[]$\\
 | 
| 330 
0806e45d873c
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
328diff
changeset | 971 |          & \bl{$\mid$} & \bl{$c$}                         & character\\
 | 
| 
0806e45d873c
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
328diff
changeset | 972 |          & \bl{$\mid$} & \bl{$r_1 + r_2$}  & alternative / choice\\
 | 
| 
0806e45d873c
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
328diff
changeset | 973 |          & \bl{$\mid$} & \bl{$r_1 \cdot r_2$} & sequence\\
 | 
| 
0806e45d873c
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
328diff
changeset | 974 |          & \bl{$\mid$} & \bl{$r^*$}            & star (zero or more)\\
 | 
| 3 | 975 |   \end{tabular}
 | 
| 976 |   \end{textblock}
 | |
| 977 | ||
| 330 
0806e45d873c
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
328diff
changeset | 978 | |
| 
0806e45d873c
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
328diff
changeset | 979 | \only<2->{\footnotesize
 | 
| 
0806e45d873c
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
328diff
changeset | 980 | \begin{textblock}{9}(2,0.5)
 | 
| 
0806e45d873c
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
328diff
changeset | 981 | \begin{bubble}[9.8cm]
 | 
| 
0806e45d873c
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
328diff
changeset | 982 | \lstinputlisting{../progs/app01.scala}
 | 
| 
0806e45d873c
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
328diff
changeset | 983 | \end{bubble}
 | 
| 
0806e45d873c
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
328diff
changeset | 984 | \end{textblock}}
 | 
| 
0806e45d873c
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
328diff
changeset | 985 | |
| 254 
dcd4688690ce
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
253diff
changeset | 986 | \end{frame}
 | 
| 3 | 987 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | 
| 988 | ||
| 989 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
| 506 | 990 | %\begin{frame}[t]
 | 
| 991 | %\frametitle{Regular Expressions}
 | |
| 992 | % | |
| 993 | %\small | |
| 994 | %In Scala:\bigskip | |
| 995 | % | |
| 996 | %\footnotesize | |
| 997 | %\lstinputlisting{../progs/app51.scala}
 | |
| 998 | % | |
| 999 | % | |
| 1000 | %\end{frame}
 | |
| 0 | 1001 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | 
| 1002 | ||
| 1003 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
| 255 
96a99237fa42
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
254diff
changeset | 1004 | \begin{frame}[t]
 | 
| 
96a99237fa42
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
254diff
changeset | 1005 | \frametitle{Strings}
 | 
| 
96a99237fa42
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
254diff
changeset | 1006 | |
| 
96a99237fa42
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
254diff
changeset | 1007 | \ldots are lists of characters. For example \code{"hello"}
 | 
| 
96a99237fa42
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
254diff
changeset | 1008 | |
| 
96a99237fa42
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
254diff
changeset | 1009 | \begin{center}
 | 
| 330 
0806e45d873c
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
328diff
changeset | 1010 | \bl{$[h, e, l, l, o]$} or just \bl{$hello$}
 | 
| 255 
96a99237fa42
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
254diff
changeset | 1011 | \end{center}
 | 
| 
96a99237fa42
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
254diff
changeset | 1012 | |
| 330 
0806e45d873c
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
328diff
changeset | 1013 | the empty string: \bl{$[]$} or \bl{\pcode{""}}\bigskip\\
 | 
| 255 
96a99237fa42
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
254diff
changeset | 1014 | |
| 
96a99237fa42
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
254diff
changeset | 1015 | the concatenation of two strings: | 
| 
96a99237fa42
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
254diff
changeset | 1016 | |
| 
96a99237fa42
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
254diff
changeset | 1017 | \begin{center}
 | 
| 
96a99237fa42
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
254diff
changeset | 1018 | \bl{$s_1 \,@\, s_2$}
 | 
| 
96a99237fa42
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
254diff
changeset | 1019 | \end{center}
 | 
| 
96a99237fa42
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
254diff
changeset | 1020 | |
| 631 | 1021 | \bl{\textit{foo $@$ bar = foobar}}\\
 | 
| 1022 | \bl{\textit{baz $@\, []$ = baz}}
 | |
| 255 
96a99237fa42
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
254diff
changeset | 1023 | |
| 
96a99237fa42
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
254diff
changeset | 1024 | \end{frame}
 | 
| 
96a99237fa42
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
254diff
changeset | 1025 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | 
| 
96a99237fa42
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
254diff
changeset | 1026 | |
| 
96a99237fa42
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
254diff
changeset | 1027 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | 
| 330 
0806e45d873c
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
328diff
changeset | 1028 | \begin{frame}[c]
 | 
| 
0806e45d873c
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
328diff
changeset | 1029 | \frametitle{Languages, Strings}
 | 
| 
0806e45d873c
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
328diff
changeset | 1030 | |
| 
0806e45d873c
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
328diff
changeset | 1031 | \begin{itemize}
 | 
| 
0806e45d873c
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
328diff
changeset | 1032 | \item \alert{\bf Strings} are lists of characters, for example
 | 
| 
0806e45d873c
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
328diff
changeset | 1033 | \begin{center}
 | 
| 
0806e45d873c
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
328diff
changeset | 1034 | \bl{$[]$},\;\bl{$abc$}  \hspace{2cm}(Pattern match: \bl{$c\!::\!s$})
 | 
| 
0806e45d873c
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
328diff
changeset | 1035 | \end{center}\bigskip
 | 
| 
0806e45d873c
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
328diff
changeset | 1036 | |
| 
0806e45d873c
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
328diff
changeset | 1037 | |
| 
0806e45d873c
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
328diff
changeset | 1038 | \item A \alert{\bf language} is a set of strings, for example\medskip
 | 
| 
0806e45d873c
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
328diff
changeset | 1039 | \begin{center}
 | 
| 
0806e45d873c
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
328diff
changeset | 1040 | \bl{$\{[], hello, \textit{foobar}, a, abc\}$}
 | 
| 
0806e45d873c
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
328diff
changeset | 1041 | \end{center}\bigskip
 | 
| 
0806e45d873c
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
328diff
changeset | 1042 | |
| 332 
4755ad4b457b
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
331diff
changeset | 1043 | \item \alert{\bf Concatenation} of strings and languages
 | 
| 330 
0806e45d873c
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
328diff
changeset | 1044 | |
| 
0806e45d873c
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
328diff
changeset | 1045 | \begin{center}
 | 
| 
0806e45d873c
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
328diff
changeset | 1046 | \begin{tabular}{rcl}
 | 
| 
0806e45d873c
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
328diff
changeset | 1047 | \bl{$\textit{foo}\;@\;bar$} & \bl{$=$} & \bl{$\textit{foobar}$}\medskip\\
 | 
| 
0806e45d873c
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
328diff
changeset | 1048 | \bl{$A\;@\;B$} & \bl{$\dn$} & \bl{$\{ s_1\,@\,s_2 \;\mid\; s_1 \in A \wedge s_2 \in B\}$}
 | 
| 
0806e45d873c
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
328diff
changeset | 1049 | \end{tabular}
 | 
| 
0806e45d873c
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
328diff
changeset | 1050 | \end{center}
 | 
| 
0806e45d873c
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
328diff
changeset | 1051 | |
| 
0806e45d873c
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
328diff
changeset | 1052 | %\item The \alert{\bf meaning} of a regular expression is a set of 
 | 
| 
0806e45d873c
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
328diff
changeset | 1053 | % strings, or language. | 
| 
0806e45d873c
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
328diff
changeset | 1054 | \end{itemize}  
 | 
| 
0806e45d873c
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
328diff
changeset | 1055 | |
| 
0806e45d873c
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
328diff
changeset | 1056 | \end{frame}
 | 
| 
0806e45d873c
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
328diff
changeset | 1057 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | 
| 
0806e45d873c
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
328diff
changeset | 1058 | |
| 761 | 1059 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | 
| 1060 | \begin{frame}[c]
 | |
| 1061 | \frametitle{The Meaning of a Regex}
 | |
| 1062 | ||
| 1063 | ...all the strings a regular expression can match. | |
| 1064 | ||
| 1065 | \begin{center}
 | |
| 1066 |  \begin{tabular}{rcl}
 | |
| 1067 |  \bl{$L(\ZERO)$}  & \bl{$\dn$} & \bl{$\{\}$}\\
 | |
| 1068 |  \bl{$L(\ONE)$}     & \bl{$\dn$} & \bl{$\{[]\}$}\\
 | |
| 1069 |  \bl{$L(c)$}            & \bl{$\dn$} & \bl{$\{[c]\}$}\\
 | |
| 1070 |  \bl{$L(r_1 + r_2)$}    & \bl{$\dn$} & \bl{$L(r_1) \cup L(r_2)$}\\
 | |
| 1071 |  \bl{$L(r_1 \cdot r_2)$} & \bl{$\dn$} & \bl{$L(r_1) \,@\, L(r_2)$}\\
 | |
| 1072 |  \bl{$L(r^*)$}           & \bl{$\dn$} & \\
 | |
| 1073 |   \end{tabular}
 | |
| 1074 | \end{center}
 | |
| 1075 | ||
| 1076 | \begin{textblock}{14}(1.5,13.5)\small
 | |
| 1077 | \bl{$L$} is a function from regular expressions to 
 | |
| 1078 | sets of strings (languages):\smallskip\\ | |
| 1079 | \bl{\quad$L$ : Rexp $\Rightarrow$ Set$[$String$]$}
 | |
| 1080 | \end{textblock}
 | |
| 1081 | ||
| 1082 | \end{frame}
 | |
| 1083 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
| 1084 | ||
| 330 
0806e45d873c
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
328diff
changeset | 1085 | |
| 
0806e45d873c
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
328diff
changeset | 1086 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | 
| 0 | 1087 | \begin{frame}[c]
 | 
| 745 | 1088 | \frametitle{The Meaning of a Regex}
 | 
| 0 | 1089 | |
| 4 | 1090 | \begin{textblock}{15}(1,4)
 | 
| 254 
dcd4688690ce
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
253diff
changeset | 1091 |  \begin{tabular}{rcl}
 | 
| 428 
a47c4227a0c6
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
334diff
changeset | 1092 |  \bl{$L(\ZERO)$}  & \bl{$\dn$} & \bl{$\{\}$}\\
 | 
| 
a47c4227a0c6
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
334diff
changeset | 1093 |  \bl{$L(\ONE)$}     & \bl{$\dn$} & \bl{$\{[]\}$}\\
 | 
| 254 
dcd4688690ce
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
253diff
changeset | 1094 |  \bl{$L(c)$}            & \bl{$\dn$} & \bl{$\{[c]\}$}\\
 | 
| 
dcd4688690ce
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
253diff
changeset | 1095 |  \bl{$L(r_1 + r_2)$}    & \bl{$\dn$} & \bl{$L(r_1) \cup L(r_2)$}\\
 | 
| 
dcd4688690ce
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
253diff
changeset | 1096 |  \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) \}$}\\
 | 
| 428 
a47c4227a0c6
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
334diff
changeset | 1097 |  \bl{$L(r^*)$}           & \bl{$\dn$} & \onslide<4->{\bl{$\bigcup_{0 \le n} L(r)^n$}}\\
 | 
| 4 | 1098 |   \end{tabular}\bigskip
 | 
| 3 | 1099 | |
| 4 | 1100 | \onslide<2->{
 | 
| 254 
dcd4688690ce
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
253diff
changeset | 1101 | \hspace{5mm}\bl{$L(r)^0 \;\dn\; \{[]\}$}\\
 | 
| 
dcd4688690ce
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
253diff
changeset | 1102 | \bl{$L(r)^{n+1} \;\dn\; L(r) \,@\, L(r)^n$}\hspace{9mm}\onslide<3->{\small\textcolor{gray}{(append on sets)}\\
 | 
| 
dcd4688690ce
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
253diff
changeset | 1103 | \small\hspace{5cm}\textcolor{gray}{$\{ s_1 @ s_2 \;|\; s_1\in L(r) \wedge s_2 \in L(r)^n \}$}}
 | 
| 4 | 1104 | } | 
| 1105 |     \end{textblock}
 | |
| 1106 | ||
| 745 | 1107 | \end{frame}
 | 
| 0 | 1108 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | 
| 1109 | ||
| 5 | 1110 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | 
| 1111 | \begin{frame}[c]
 | |
| 254 
dcd4688690ce
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
253diff
changeset | 1112 | \frametitle{The Meaning of Matching}
 | 
| 5 | 1113 | |
| 254 
dcd4688690ce
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
253diff
changeset | 1114 | \begin{bubble}[10cm]
 | 
| 559 | 1115 | \large\bf | 
| 507 | 1116 | A regular expression \bl{$r$} matches a string~\bl{$s$} 
 | 
| 254 
dcd4688690ce
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
253diff
changeset | 1117 | provided | 
| 5 | 1118 | |
| 1119 | \begin{center}
 | |
| 254 
dcd4688690ce
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
253diff
changeset | 1120 | \bl{$s \in L(r)$}\\ 
 | 
| 5 | 1121 | \end{center}
 | 
| 330 
0806e45d873c
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
328diff
changeset | 1122 | \end{bubble}\bigskip\bigskip
 | 
| 
0806e45d873c
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
328diff
changeset | 1123 | |
| 
0806e45d873c
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
328diff
changeset | 1124 | \ldots and the point of the next lecture is | 
| 
0806e45d873c
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
328diff
changeset | 1125 | to decide this problem as fast as possible (unlike Python, | 
| 428 
a47c4227a0c6
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
334diff
changeset | 1126 | Ruby, Java) | 
| 5 | 1127 | |
| 254 
dcd4688690ce
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
253diff
changeset | 1128 | \end{frame}
 | 
| 5 | 1129 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | 
| 1130 | ||
| 631 | 1131 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | 
| 1132 | \begin{frame}[c]
 | |
| 1133 |   \frametitle{The Power Operation}
 | |
| 1134 | ||
| 1135 |   \begin{itemize}
 | |
| 1136 |   \item The \alert{\textbf{\boldmath$n$th Power}} of a language:
 | |
| 1137 | ||
| 1138 |   \begin{center}
 | |
| 1139 |   \begin{tabular}{lcl}
 | |
| 1140 |   \bl{$A^0$}    & \bl{$\dn$} & \bl{$\{[]\}$}\\
 | |
| 1141 |   \bl{$A^{n+1}$} & \bl{$\dn$} & \bl{$A \,@\, A^n$}
 | |
| 1142 |   \end{tabular}
 | |
| 1143 |   \end{center}\bigskip
 | |
| 1144 | ||
| 1145 | \item[] For example | |
| 1146 | ||
| 1147 |   \begin{center}
 | |
| 1148 |   \begin{tabular}{lcl@{\hspace{10mm}}l}
 | |
| 1149 |   \bl{$A^4$} & \bl{$=$} & \bl{$A \,@\, A \,@\, A \,@\, A$} & \bl{$(@\,\{[]\})$}\\
 | |
| 1150 |   \bl{$A^1$} & \bl{$=$} & \bl{$A$} & \bl{$(@\,\{[]\})$}\\
 | |
| 1151 |   \bl{$A^0$} & \bl{$=$} & \bl{$\{[]\}$}\\
 | |
| 1152 |   \end{tabular}
 | |
| 1153 |   \end{center}
 | |
| 1154 | ||
| 1155 |   \end{itemize}  
 | |
| 1156 | ||
| 1157 |   \end{frame}
 | |
| 1158 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
| 1159 | ||
| 1160 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
| 1161 | \begin{frame}[c]
 | |
| 1162 |   \frametitle{Questions}
 | |
| 1163 | ||
| 1164 |   \begin{itemize}
 | |
| 1165 |   \item Say \bl{$A = \{[a],[b],[c],[d]\}$}.\bigskip
 | |
| 1166 | ||
| 1167 | \item[] | |
| 1168 |   How many strings are in \bl{$A^4$}\,?
 | |
| 1169 | \bigskip\medskip\pause | |
| 1170 | ||
| 1171 | ||
| 1172 | \item[] | |
| 1173 |   What if \bl{$A = \{[a],[b],[c],[]\}$};\\ 
 | |
| 1174 |   how many strings are then in \bl{$A^4$}\,?
 | |
| 1175 |   \end{itemize}  
 | |
| 1176 | ||
| 1177 | \end{frame}
 | |
| 1178 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
| 1179 | ||
| 1180 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
| 1181 | \begin{frame}[c]
 | |
| 743 | 1182 | \frametitle{Languages (Sets of Strings)}
 | 
| 1183 | ||
| 1184 | \begin{itemize}
 | |
| 1185 | ||
| 1186 | \item A \alert{\bf Language} is a set of strings, for example\medskip
 | |
| 1187 | \begin{center}
 | |
| 1188 | \bl{$\{[], hello, foobar, a, abc\}$}
 | |
| 1189 | \end{center}\bigskip
 | |
| 1190 | ||
| 1191 | \item \alert{\bf Concatenation} for strings and languages
 | |
| 1192 | ||
| 1193 | \begin{center}
 | |
| 1194 | \begin{tabular}{rcl}
 | |
| 1195 | \bl{$foo\;@\;bar$} & \bl{$=$} & \bl{$foobar$}\medskip\\
 | |
| 1196 | \bl{$A\;@\;B$}     & \bl{$\dn$} & \bl{$\{ s_1\,@\,s_2 \;\mid\; s_1 \in A \wedge s_2 \in B\}$}
 | |
| 1197 | \end{tabular}
 | |
| 1198 | \end{center}
 | |
| 1199 | \bigskip | |
| 1200 | ||
| 1201 | \small | |
| 1202 | \item [] For example \bl{$A = \{foo, bar\}$}, \bl{$B = \{a, b\}$}
 | |
| 1203 | ||
| 1204 | \[ | |
| 1205 | \bl{A \,@\, B = \{fooa, foob, bara, barb\}}
 | |
| 1206 | \] | |
| 1207 | ||
| 1208 | \end{itemize}  
 | |
| 1209 | \end{frame}
 | |
| 1210 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
| 1211 | ||
| 1212 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
| 1213 | \begin{frame}[c]
 | |
| 1214 |   \frametitle{Two Corner Cases}
 | |
| 1215 | ||
| 1216 | \Large | |
| 1217 |   \begin{center}
 | |
| 1218 |   \bl{$A \,@\, \{[]\} = \;?$}\bigskip\bigskip\pause\\
 | |
| 1219 |   \bl{$A \,@\, \{\} = \;?$}
 | |
| 1220 |   \end{center}  
 | |
| 1221 | ||
| 1222 |   \end{frame}
 | |
| 1223 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
| 1224 | ||
| 1225 | ||
| 1226 | ||
| 1227 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
| 1228 | \begin{frame}[c]
 | |
| 745 | 1229 | \frametitle{The Meaning of a Regex}
 | 
| 743 | 1230 | |
| 1231 | ...all the strings a regular expression can match. | |
| 1232 | ||
| 1233 | \begin{center}
 | |
| 1234 |  \begin{tabular}{rcl}
 | |
| 1235 |  \bl{$L(\ZERO)$}  & \bl{$\dn$} & \bl{$\{\}$}\\
 | |
| 1236 |  \bl{$L(\ONE)$}     & \bl{$\dn$} & \bl{$\{[]\}$}\\
 | |
| 1237 |  \bl{$L(c)$}            & \bl{$\dn$} & \bl{$\{[c]\}$}\\
 | |
| 1238 |  \bl{$L(r_1 + r_2)$}    & \bl{$\dn$} & \bl{$L(r_1) \cup L(r_2)$}\\
 | |
| 1239 |  \bl{$L(r_1 \cdot r_2)$} & \bl{$\dn$} & \bl{$L(r_1) \,@\, L(r_2)$}\\
 | |
| 1240 |  \bl{$L(r^*)$}           & \bl{$\dn$} & \\
 | |
| 1241 |   \end{tabular}
 | |
| 1242 | \end{center}
 | |
| 1243 | ||
| 1244 | \begin{textblock}{14}(1.5,13.5)\small
 | |
| 1245 | \bl{$L$} is a function from regular expressions to 
 | |
| 1246 | sets of strings (languages):\smallskip\\ | |
| 1247 | \bl{\quad$L$ : Rexp $\Rightarrow$ Set$[$String$]$}
 | |
| 1248 | \end{textblock}
 | |
| 1249 | ||
| 1250 | \end{frame}
 | |
| 1251 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
| 1252 | ||
| 1253 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
| 1254 | \begin{frame}[c]
 | |
| 1255 | \frametitle{The Power Operation}
 | |
| 1256 | ||
| 1257 | \begin{itemize}
 | |
| 1258 | \item The \alert{\textbf{\boldmath$n$th Power}} of a language:
 | |
| 1259 | ||
| 1260 | \begin{center}
 | |
| 1261 | \begin{tabular}{lcl}
 | |
| 1262 | \bl{$A^0$}    & \bl{$\dn$} & \bl{$\{[]\}$}\\
 | |
| 1263 | \bl{$A^{n+1}$} & \bl{$\dn$} & \bl{$A \,@\, A^n$}
 | |
| 1264 | \end{tabular}
 | |
| 1265 | \end{center}\bigskip
 | |
| 1266 | ||
| 1267 | \item[] For example | |
| 1268 | ||
| 1269 | \begin{center}
 | |
| 1270 | \begin{tabular}{lcl@{\hspace{10mm}}l}
 | |
| 1271 | \bl{$A^4$} & \bl{$=$} & \bl{$A \,@\, A \,@\, A \,@\, A$} & \bl{$(@\,\{[]\})$}\\
 | |
| 1272 | \bl{$A^1$} & \bl{$=$} & \bl{$A$} & \bl{$(@\,\{[]\})$}\\
 | |
| 1273 | \bl{$A^0$} & \bl{$=$} & \bl{$\{[]\}$}\\
 | |
| 1274 | \end{tabular}
 | |
| 1275 | \end{center}
 | |
| 1276 | ||
| 1277 | \end{itemize}  
 | |
| 1278 | ||
| 1279 | \end{frame}
 | |
| 1280 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
| 1281 | ||
| 1282 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
| 1283 | \begin{frame}[c]
 | |
| 631 | 1284 |   \frametitle{The Star Operation}
 | 
| 1285 | ||
| 1286 |   \begin{itemize}
 | |
| 1287 |   \item The \alert{\bf Kleene Star} of a \underline{language}:
 | |
| 1288 | \bigskip | |
| 1289 | ||
| 1290 |   \begin{center}
 | |
| 1291 |   \begin{tabular}{c}
 | |
| 1292 |   \bl{$A\star \dn \bigcup_{0\le n} A^n$}
 | |
| 1293 |   \end{tabular}
 | |
| 1294 |   \end{center}\bigskip
 | |
| 1295 | ||
| 1296 | \item[] This expands to | |
| 1297 | ||
| 1298 | \[ | |
| 1299 |   \bl{A^0 \cup A^1 \cup A^2 \cup A^3 \cup A^4 \cup \ldots}
 | |
| 1300 | \] | |
| 1301 | ||
| 1302 | or | |
| 1303 | ||
| 1304 | \small | |
| 1305 | \[ | |
| 1306 |   \bl{\{[]\} \;\cup\; A \;\cup\; A\,@\,A \;\cup\; 
 | |
| 1307 | A\,@\,A\,@\,A \;\cup\; A\,@\,A\,@\,A\,@\,A \cup \ldots} | |
| 1308 | \] | |
| 1309 | ||
| 1310 |   \end{itemize}  
 | |
| 1311 | ||
| 1312 |   \end{frame}
 | |
| 1313 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
| 1314 | ||
| 1315 | ||
| 0 | 1316 | |
| 1317 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
| 1318 | \begin{frame}[c]
 | |
| 253 
75c469893514
added coursework
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
252diff
changeset | 1319 | \frametitle{Written Exam}
 | 
| 
75c469893514
added coursework
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
252diff
changeset | 1320 | |
| 
75c469893514
added coursework
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
252diff
changeset | 1321 | \begin{itemize}
 | 
| 428 
a47c4227a0c6
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
334diff
changeset | 1322 | \item Accounts for 80\%.\bigskip | 
| 253 
75c469893514
added coursework
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
252diff
changeset | 1323 | |
| 559 | 1324 | \item The question ``\textit{Is this relevant for
 | 
| 330 
0806e45d873c
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
328diff
changeset | 1325 | the exam?}'' is very demotivating for the lecturer!\bigskip\\ | 
| 253 
75c469893514
added coursework
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
252diff
changeset | 1326 | |
| 
75c469893514
added coursework
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
252diff
changeset | 1327 | \item Deal: Whatever is in the homework (and is not marked | 
| 330 
0806e45d873c
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
328diff
changeset | 1328 |       ``\textit{optional}'') is relevant for the exam.\bigskip
 | 
| 
0806e45d873c
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
328diff
changeset | 1329 | |
| 
0806e45d873c
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
328diff
changeset | 1330 | \item Each lecture has also a handout. There are also handouts about | 
| 
0806e45d873c
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
328diff
changeset | 1331 | notation and Scala. | 
| 253 
75c469893514
added coursework
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
252diff
changeset | 1332 | \end{itemize}
 | 
| 
75c469893514
added coursework
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
252diff
changeset | 1333 | |
| 
75c469893514
added coursework
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
252diff
changeset | 1334 | \end{frame}
 | 
| 
75c469893514
added coursework
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
252diff
changeset | 1335 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | 
| 
75c469893514
added coursework
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
252diff
changeset | 1336 | |
| 
75c469893514
added coursework
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
252diff
changeset | 1337 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | 
| 
75c469893514
added coursework
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
252diff
changeset | 1338 | \begin{frame}[t]
 | 
| 
75c469893514
added coursework
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
252diff
changeset | 1339 | \frametitle{Coursework}
 | 
| 0 | 1340 | |
| 1341 | \begin{itemize}
 | |
| 428 
a47c4227a0c6
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
334diff
changeset | 1342 | \item Accounts for 20\%. Two strands. Choose \alert{\bf one}!\bigskip
 | 
| 0 | 1343 | \end{itemize}
 | 
| 1344 | ||
| 255 
96a99237fa42
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
254diff
changeset | 1345 | \begin{columns}[t]
 | 
| 
96a99237fa42
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
254diff
changeset | 1346 | \begin{column}{.5\textwidth}
 | 
| 
96a99237fa42
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
254diff
changeset | 1347 | \underline{\bf Strand 1}\medskip
 | 
| 253 
75c469893514
added coursework
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
252diff
changeset | 1348 | \begin{itemize}
 | 
| 631 | 1349 | \item 4 programming tasks: | 
| 253 
75c469893514
added coursework
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
252diff
changeset | 1350 | \begin{itemize}
 | 
| 631 | 1351 | \item matcher (4\%, 11.10.) | 
| 1352 | \item lexer (5\%, 04.11.) | |
| 1353 | \item parser (5\%, 22.11.) | |
| 1354 | \item compiler (6\%, 13.12.) | |
| 253 
75c469893514
added coursework
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
252diff
changeset | 1355 | \end{itemize}
 | 
| 631 | 1356 | \item in any lang.~you like,\\ but I want to see the\\ code | 
| 253 
75c469893514
added coursework
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
252diff
changeset | 1357 | \end{itemize}
 | 
| 
75c469893514
added coursework
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
252diff
changeset | 1358 | \end{column}
 | 
| 
75c469893514
added coursework
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
252diff
changeset | 1359 | |
| 
75c469893514
added coursework
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
252diff
changeset | 1360 | \hspace{-45pt}\vrule{}\hspace{10pt}
 | 
| 255 
96a99237fa42
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
254diff
changeset | 1361 | \begin{column}{.5\textwidth}
 | 
| 
96a99237fa42
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
254diff
changeset | 1362 | \underline{\bf Strand 2}\smallskip\begin{itemize}
 | 
| 253 
75c469893514
added coursework
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
252diff
changeset | 1363 | \item one task: prove the correctness of a regular expression matcher in | 
| 559 | 1364 | the \underline{Isabelle} theorem prover
 | 
| 631 | 1365 | \item 20\%, submission on~13.12.\hspace{-5mm}\mbox{}
 | 
| 253 
75c469893514
added coursework
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
252diff
changeset | 1366 | \end{itemize}
 | 
| 
75c469893514
added coursework
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
252diff
changeset | 1367 | \end{column}
 | 
| 
75c469893514
added coursework
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
252diff
changeset | 1368 | \end{columns}\medskip
 | 
| 
75c469893514
added coursework
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
252diff
changeset | 1369 | |
| 
75c469893514
added coursework
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
252diff
changeset | 1370 | \small | 
| 
75c469893514
added coursework
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
252diff
changeset | 1371 | \begin{itemize}
 | 
| 
75c469893514
added coursework
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
252diff
changeset | 1372 | \item Solving more than one strand will {\bf not} give you more 
 | 
| 506 | 1373 | marks. | 
| 1374 | ||
| 253 
75c469893514
added coursework
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
252diff
changeset | 1375 | \end{itemize}
 | 
| 
75c469893514
added coursework
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
252diff
changeset | 1376 | |
| 
75c469893514
added coursework
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
252diff
changeset | 1377 | \end{frame}
 | 
| 0 | 1378 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | 
| 1379 | ||
| 255 
96a99237fa42
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
254diff
changeset | 1380 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | 
| 745 | 1381 | %\begin{frame}[c]
 | 
| 1382 | %\frametitle{Lecture Capture}
 | |
| 1383 | % | |
| 1384 | %\begin{itemize}
 | |
| 1385 | %\item Hope it works\ldots\pause actually no, it does not!\medskip\pause | |
| 1386 | %\item It is important to use lecture capture wisely\\ (it is only the ``baseline''): | |
| 1387 | %\begin{itemize}  
 | |
| 1388 | %\item Lecture recordings are a study and revision aid. | |
| 1389 | %\item Statistically, there is a clear and direct link between attendance and | |
| 1390 | % attainment: students who do not attend lectures, do less well in exams. | |
| 1391 | %\end{itemize}
 | |
| 1392 | % | |
| 1393 | %\item Attending a lecture is more than watching it online -- if you do not | |
| 1394 | %attend, you miss out! | |
| 1395 | % | |
| 1396 | %\end{itemize}
 | |
| 1397 | % | |
| 1398 | %\end{frame}
 | |
| 506 | 1399 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | 
| 1400 | ||
| 1401 | ||
| 1402 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
| 1403 | \begin{frame}[c]
 | |
| 255 
96a99237fa42
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
254diff
changeset | 1404 | \frametitle{\begin{tabular}{c}\\[3cm]\alert{Questions?}\end{tabular}}
 | 
| 
96a99237fa42
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
254diff
changeset | 1405 | |
| 
96a99237fa42
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
254diff
changeset | 1406 | \mbox{}
 | 
| 
96a99237fa42
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
254diff
changeset | 1407 | \end{frame}
 | 
| 
96a99237fa42
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
254diff
changeset | 1408 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | 
| 0 | 1409 | \end{document}
 | 
| 1410 | ||
| 1411 | %%% Local Variables: | |
| 1412 | %%% mode: latex | |
| 1413 | %%% TeX-master: t | |
| 1414 | %%% End: | |
| 1415 |