| author | Christian Urban <christian dot urban at kcl dot ac dot uk> | 
| Mon, 20 Jul 2020 10:06:43 +0100 | |
| changeset 735 | 0426cd1336f7 | 
| parent 728 | 9a251e86c3ee | 
| child 743 | f063a6cd5d91 | 
| permissions | -rw-r--r-- | 
| 631 | 1 | % !TEX program = xelatex | 
| 95 
dbe49327b6c5
added new stuff
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
93diff
changeset | 2 | \documentclass[dvipsnames,14pt,t,xelatex]{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 | |
| 252 
e8ef8f38ca84
added style files
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
215diff
changeset | 8 | \hfuzz=220pt | 
| 
e8ef8f38ca84
added style files
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
215diff
changeset | 9 | |
| 254 
dcd4688690ce
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
253diff
changeset | 10 | \lstset{language=Scala,
 | 
| 
dcd4688690ce
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
253diff
changeset | 11 | style=mystyle, | 
| 
dcd4688690ce
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
253diff
changeset | 12 | numbersep=0pt, | 
| 
dcd4688690ce
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
253diff
changeset | 13 | numbers=none, | 
| 
dcd4688690ce
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
253diff
changeset | 14 | xleftmargin=0mm} | 
| 
dcd4688690ce
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
253diff
changeset | 15 | |
| 253 
75c469893514
added coursework
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
252diff
changeset | 16 | \newcommand{\bl}[1]{\textcolor{blue}{#1}}     
 | 
| 559 | 17 | |
| 0 | 18 | % beamer stuff | 
| 428 
a47c4227a0c6
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
334diff
changeset | 19 | \renewcommand{\slidecaption}{CFL 01, King's College London}
 | 
| 0 | 20 | |
| 721 
e712943cff71
added slides from Rochester
 Christian Urban <christian.urban@kcl.ac.uk> parents: 
637diff
changeset | 21 | %% 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 | 22 | %% 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 | 23 | %% https://cs.rit.edu/~hh/teaching/_media/cc18/lectures/lect3/main.pdf | 
| 0 | 24 | |
| 25 | \begin{document}
 | |
| 26 | ||
| 27 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
| 253 
75c469893514
added coursework
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
252diff
changeset | 28 | \begin{frame}[t]
 | 
| 510 | 29 | \frametitle{%  
 | 
| 0 | 30 |   \begin{tabular}{@ {}c@ {}}
 | 
| 1 | 31 | \\[-3mm] | 
| 428 
a47c4227a0c6
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
334diff
changeset | 32 | \LARGE Compilers and \\[-1mm] | 
| 1 | 33 | \LARGE Formal Languages (1)\\[-3mm] | 
| 0 | 34 |   \end{tabular}}
 | 
| 35 | ||
| 36 |   \begin{center}
 | |
| 507 | 37 |   %\includegraphics[scale=0.3]{pics/ante1.jpg}\hspace{5mm}
 | 
| 38 |   %\includegraphics[scale=0.31]{pics/ante2.jpg}\\
 | |
| 39 |   %\footnotesize\textcolor{gray}{Antikythera automaton, 100 BC (Archimedes?)}
 | |
| 0 | 40 |   \end{center}
 | 
| 41 | ||
| 510 | 42 | \normalsize | 
| 0 | 43 |   \begin{center}
 | 
| 44 |   \begin{tabular}{ll}
 | |
| 45 | Email: & christian.urban at kcl.ac.uk\\ | |
| 631 | 46 | Office Hours: & Thursdays 12 -- 14\\ | 
| 636 | 47 | Location: & N7.07 (North Wing, Bush House)\\ | 
| 631 | 48 | Slides \& Progs: & KEATS\\ | 
| 0 | 49 |   \end{tabular}
 | 
| 50 |   \end{center}
 | |
| 51 | ||
| 253 
75c469893514
added coursework
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
252diff
changeset | 52 | \end{frame}
 | 
| 559 | 53 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | 
| 0 | 54 | |
| 55 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
| 559 | 56 | \begin{frame}[t]
 | 
| 57 | \frametitle{Why Study Compilers?}
 | |
| 0 | 58 | |
| 560 | 59 | John Regehr {\small(Univ.~Utah, LLVM compiler hacker)}\smallskip\\
 | 
| 255 
96a99237fa42
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
254diff
changeset | 60 | |
| 559 | 61 | \begin{bubble}[10.5cm]
 | 
| 62 |   \bf ``\ldots{}It’s effectively a perpetual
 | |
| 63 | employment act for solid compiler hackers.'' | |
| 64 | \end{bubble}
 | |
| 0 | 65 | |
| 559 | 66 | \onslide<1->{
 | 
| 67 | \only<2>{
 | |
| 68 | \begin{itemize}
 | |
| 69 | \item {\bf Hardware is getting weirder
 | |
| 631 | 70 | rather than getting clocked faster.} | 
| 0 | 71 | |
| 559 | 72 | \begin{itemize}
 | 
| 631 | 73 | \item[] ``Almost all processors are multicores nowadays and it looks | 
| 74 | like there is increasing asymmetry in resources across cores. | |
| 75 | Processors come with vector units, crypto accelerators etc. We have | |
| 76 | DSPs, GPUs, ARM big.little, and Xeon Phi. This is only scratching the | |
| 77 | surface.'' | |
| 559 | 78 | \end{itemize}  
 | 
| 79 | \end{itemize}}
 | |
| 255 
96a99237fa42
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
254diff
changeset | 80 | \only<3>{
 | 
| 559 | 81 | \begin{itemize}
 | 
| 82 | \item {\bf We’re getting tired of low-level languages and
 | |
| 631 | 83 | their associated security disasters.} | 
| 559 | 84 | |
| 85 | \begin{itemize}
 | |
| 631 | 86 | \item [] ``We want to write new code, to whatever extent possible, in | 
| 87 | safer, higher-level languages. Compilers are caught right in the | |
| 88 | middle of these opposing trends: one of their main jobs is to help | |
| 89 | bridge the large and growing gap between increasingly high-level | |
| 90 | languages and increasingly wacky platforms.'' | |
| 559 | 91 | \end{itemize}  
 | 
| 92 | \end{itemize}}}
 | |
| 1 | 93 | |
| 253 
75c469893514
added coursework
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
252diff
changeset | 94 | \end{frame}
 | 
| 0 | 95 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | 
| 1 | 96 | |
| 255 
96a99237fa42
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
254diff
changeset | 97 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | 
| 631 | 98 | \begin{frame}[t]
 | 
| 99 |   \frametitle{What are Compilers?}
 | |
| 100 | ||
| 101 | \begin{center}
 | |
| 102 | \begin{tikzpicture}[]
 | |
| 103 |   \node (0) at (-2.3,0) {\includegraphics[scale=0.3]{pics/csource.png}};
 | |
| 104 |   \node (1) [right=35mm] at (0) {\includegraphics[scale=0.3]{pics/cassmbl.png}}; 
 | |
| 105 | \draw [->,line width=4mm, red] (0) -- (1); | |
| 635 | 106 |   \node (2) [below=25mm] at (0) {\LARGE\bf``source''};
 | 
| 107 |   \node (3) [right=35mm] at (2) {\LARGE\bf``binary''};
 | |
| 108 | \draw [->,line width=1mm] (2) -- (3); | |
| 631 | 109 | \end{tikzpicture}
 | 
| 110 | \end{center}
 | |
| 111 | ||
| 112 | \begin{textblock}{10}(1,13.5)
 | |
| 113 | Compiler explorers, e.g.: \url{https://gcc.godbolt.org}
 | |
| 114 | \end{textblock}
 | |
| 115 | ||
| 116 | \end{frame} 
 | |
| 117 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
| 118 | ||
| 119 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
| 120 | \begin{frame}[c]
 | |
| 121 | \frametitle{\begin{tabular}{c}Why Bother?\\[-2mm] Compilers \& Boeings 777\end{tabular}}
 | |
| 122 | ||
| 123 | First flight in 1994. They want to achieve triple redundancy in hardware | |
| 124 | faults.\bigskip | |
| 125 | ||
| 126 | They compile 1 Ada program to\medskip | |
| 127 | ||
| 128 | \begin{itemize}
 | |
| 129 | \item Intel 80486 | |
| 130 | \item Motorola 68040 (old Macintosh's) | |
| 131 | \item AMD 29050 (RISC chips used often in laser printers) | |
| 132 | \end{itemize}\medskip\medskip
 | |
| 133 | ||
| 134 | using 3 independent compilers.\bigskip\pause | |
| 135 | ||
| 136 | \small Airbus uses C and static analysers. Recently started using CompCert. | |
| 137 | ||
| 138 | \end{frame}
 | |
| 139 | %%%%%%%%%%% | |
| 140 | ||
| 141 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
| 255 
96a99237fa42
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
254diff
changeset | 142 | \begin{frame}[c]
 | 
| 
96a99237fa42
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
254diff
changeset | 143 | \frametitle{Why Bother?}
 | 
| 
96a99237fa42
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
254diff
changeset | 144 | |
| 428 
a47c4227a0c6
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
334diff
changeset | 145 | \begin{columns}[t]
 | 
| 255 
96a99237fa42
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
254diff
changeset | 146 | \begin{column}{.5\textwidth}
 | 
| 559 | 147 | Ruby, Python, Java 8\medskip\\ | 
| 428 
a47c4227a0c6
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
334diff
changeset | 148 | \begin{tikzpicture}\footnotesize
 | 
| 
a47c4227a0c6
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
334diff
changeset | 149 | \begin{axis}[
 | 
| 
a47c4227a0c6
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
334diff
changeset | 150 |     xlabel={$n$},
 | 
| 
a47c4227a0c6
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
334diff
changeset | 151 |     x label style={at={(1.05,0.0)}},
 | 
| 
a47c4227a0c6
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
334diff
changeset | 152 |     ylabel={time in secs},
 | 
| 
a47c4227a0c6
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
334diff
changeset | 153 | enlargelimits=false, | 
| 
a47c4227a0c6
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
334diff
changeset | 154 |     xtick={0,5,...,30},
 | 
| 
a47c4227a0c6
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
334diff
changeset | 155 | xmax=33, | 
| 
a47c4227a0c6
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
334diff
changeset | 156 | ymax=35, | 
| 
a47c4227a0c6
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
334diff
changeset | 157 |     ytick={0,5,...,30},
 | 
| 
a47c4227a0c6
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
334diff
changeset | 158 | scaled ticks=false, | 
| 
a47c4227a0c6
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
334diff
changeset | 159 | axis lines=left, | 
| 
a47c4227a0c6
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
334diff
changeset | 160 | width=5.5cm, | 
| 
a47c4227a0c6
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
334diff
changeset | 161 | height=4cm, | 
| 
a47c4227a0c6
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
334diff
changeset | 162 |     legend entries={Python,Ruby},  
 | 
| 
a47c4227a0c6
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
334diff
changeset | 163 | legend pos=north west, | 
| 
a47c4227a0c6
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
334diff
changeset | 164 | legend cell align=left] | 
| 559 | 165 | \addplot[blue,mark=*, mark options={fill=white}] table {re-python.data};
 | 
| 166 | \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 | 167 | \end{axis}
 | 
| 
a47c4227a0c6
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
334diff
changeset | 168 | \end{tikzpicture}
 | 
| 
a47c4227a0c6
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
334diff
changeset | 169 | \begin{tikzpicture}\footnotesize
 | 
| 
a47c4227a0c6
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
334diff
changeset | 170 | \begin{axis}[
 | 
| 
a47c4227a0c6
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
334diff
changeset | 171 |     xlabel={$n$},
 | 
| 
a47c4227a0c6
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
334diff
changeset | 172 |     x label style={at={(1.05,0.0)}},
 | 
| 
a47c4227a0c6
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
334diff
changeset | 173 |     ylabel={time in secs},
 | 
| 
a47c4227a0c6
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
334diff
changeset | 174 | enlargelimits=false, | 
| 
a47c4227a0c6
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
334diff
changeset | 175 |     xtick={0,5,...,30},
 | 
| 
a47c4227a0c6
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
334diff
changeset | 176 | xmax=33, | 
| 
a47c4227a0c6
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
334diff
changeset | 177 | ymax=35, | 
| 
a47c4227a0c6
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
334diff
changeset | 178 |     ytick={0,5,...,30},
 | 
| 
a47c4227a0c6
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
334diff
changeset | 179 | scaled ticks=false, | 
| 
a47c4227a0c6
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
334diff
changeset | 180 | axis lines=left, | 
| 
a47c4227a0c6
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
334diff
changeset | 181 | width=5.5cm, | 
| 
a47c4227a0c6
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
334diff
changeset | 182 | height=4cm, | 
| 631 | 183 |     legend entries={Python, Java 8, JavaScript},  
 | 
| 428 
a47c4227a0c6
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
334diff
changeset | 184 | legend pos=north west, | 
| 
a47c4227a0c6
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
334diff
changeset | 185 | legend cell align=left] | 
| 559 | 186 | \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 | 187 | \addplot[cyan,mark=*, mark options={fill=white}] table {re-java.data};
 | 
| 631 | 188 | \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 | 189 | \end{axis}
 | 
| 
a47c4227a0c6
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
334diff
changeset | 190 | \end{tikzpicture}
 | 
| 
a47c4227a0c6
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
334diff
changeset | 191 | |
| 
a47c4227a0c6
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
334diff
changeset | 192 | \end{column}
 | 
| 
a47c4227a0c6
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
334diff
changeset | 193 | \begin{column}{.5\textwidth}
 | 
| 
a47c4227a0c6
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
334diff
changeset | 194 | Us (after next lecture)\medskip\\ | 
| 
a47c4227a0c6
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
334diff
changeset | 195 | \begin{tikzpicture}\footnotesize
 | 
| 
a47c4227a0c6
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
334diff
changeset | 196 | \begin{axis}[
 | 
| 
a47c4227a0c6
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
334diff
changeset | 197 |     xlabel={$n$},
 | 
| 
a47c4227a0c6
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
334diff
changeset | 198 |     x label style={at={(1.07,0.0)}},
 | 
| 
a47c4227a0c6
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
334diff
changeset | 199 |     ylabel={time in secs},
 | 
| 
a47c4227a0c6
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
334diff
changeset | 200 | enlargelimits=false, | 
| 442 
84d6714840c9
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
437diff
changeset | 201 |     xtick={0,5000,...,10000},
 | 
| 
84d6714840c9
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
437diff
changeset | 202 | xmax=11000, | 
| 428 
a47c4227a0c6
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
334diff
changeset | 203 | ymax=35, | 
| 
a47c4227a0c6
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
334diff
changeset | 204 |     ytick={0,5,...,30},
 | 
| 
a47c4227a0c6
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
334diff
changeset | 205 | scaled ticks=false, | 
| 
a47c4227a0c6
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
334diff
changeset | 206 | axis lines=left, | 
| 
a47c4227a0c6
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
334diff
changeset | 207 | width=5.5cm, | 
| 
a47c4227a0c6
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
334diff
changeset | 208 | height=4cm] | 
| 437 
fe387fcbf2ee
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
428diff
changeset | 209 | \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 | 210 | \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 | 211 | \end{axis}
 | 
| 
a47c4227a0c6
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
334diff
changeset | 212 | \end{tikzpicture}
 | 
| 
a47c4227a0c6
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
334diff
changeset | 213 | \begin{tikzpicture}\footnotesize
 | 
| 
a47c4227a0c6
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
334diff
changeset | 214 | \begin{axis}[
 | 
| 
a47c4227a0c6
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
334diff
changeset | 215 |     xlabel={$n$},
 | 
| 
a47c4227a0c6
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
334diff
changeset | 216 |     x label style={at={(1.07,0.0)}},
 | 
| 
a47c4227a0c6
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
334diff
changeset | 217 |     ylabel={time in secs},
 | 
| 
a47c4227a0c6
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
334diff
changeset | 218 | enlargelimits=false, | 
| 
a47c4227a0c6
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
334diff
changeset | 219 | ymax=35, | 
| 
a47c4227a0c6
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
334diff
changeset | 220 |     ytick={0,5,...,30},
 | 
| 
a47c4227a0c6
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
334diff
changeset | 221 | scaled ticks=false, | 
| 
a47c4227a0c6
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
334diff
changeset | 222 | axis lines=left, | 
| 
a47c4227a0c6
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
334diff
changeset | 223 | width=5.5cm, | 
| 
a47c4227a0c6
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
334diff
changeset | 224 | height=4cm] | 
| 
a47c4227a0c6
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
334diff
changeset | 225 | \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 | 226 | \end{axis}
 | 
| 255 
96a99237fa42
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
254diff
changeset | 227 | \end{tikzpicture}
 | 
| 
96a99237fa42
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
254diff
changeset | 228 | \end{column}
 | 
| 428 
a47c4227a0c6
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
334diff
changeset | 229 | \end{columns}\bigskip
 | 
| 255 
96a99237fa42
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
254diff
changeset | 230 | |
| 428 
a47c4227a0c6
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
334diff
changeset | 231 | \small\centering | 
| 635 | 232 | matching \bl{\texttt{[a?]\{n\}[a]\{n\}}} and \bl{\texttt{(a*)*b}}
 | 
| 233 | against \bl{$\underbrace{\texttt{a}...\texttt{a}}_n$}
 | |
| 510 | 234 | \end{frame} 
 | 
| 255 
96a99237fa42
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
254diff
changeset | 235 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | 
| 631 | 236 | |
| 237 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
| 238 | \begin{frame}[c,fragile]
 | |
| 239 |   \frametitle{Incidents}
 | |
| 240 | ||
| 241 |   \begin{itemize}
 | |
| 242 |   \item a global outage on 2 July 2019 at \textbf{Cloudflare} 
 | |
| 243 | (first one for six years)\medskip | |
| 244 | ||
| 245 |   \begin{center}\small\color{blue}
 | |
| 246 |   \begin{verbatim}  
 | |
| 247 | (?:(?:\"|'|\]|\}|\\|\d|(?:nan|infinity|true|false| | |
| 248 | null|undefined|symbol|math)|\`|\-|\+)+[)]*;?((?:\s | |
| 249 |   |-|~|!|{}|\|\||\+)*.*(?:.*=.*)))  
 | |
| 250 |   \end{verbatim}
 | |
| 251 |   \end{center}\bigskip\bigskip\bigskip\bigskip\bigskip\bigskip\bigskip    
 | |
| 252 | ||
| 253 |   \item on 20 July 2016 the \textbf{Stack Exchange} webpage went down
 | |
| 254 | because of an evil regular expression | |
| 255 |   \end{itemize}
 | |
| 256 | ||
| 257 |   \begin{textblock}{6}(9,7.6)
 | |
| 728 | 258 |     \includegraphics[scale=0.14]{../pics/cloudflare.png}\\
 | 
| 631 | 259 | \footnotesize | 
| 260 | It serves more web traffic than Twitter, Amazon, Apple, Instagram, Bing \& Wikipedia combined. | |
| 261 |     \end{textblock}
 | |
| 262 | ||
| 263 |   \end{frame}
 | |
| 264 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
| 265 | ||
| 560 | 266 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | 
| 267 | \begin{frame}[c]
 | |
| 268 | \frametitle{Evil Regular Expressions}
 | |
| 269 | ||
| 270 | \begin{itemize}
 | |
| 271 | \item \alert{R}egular \alert{e}xpression \alert{D}enial \alert{o}f \alert{S}ervice (ReDoS)\medskip
 | |
| 272 | \item Evil regular expressions\medskip | |
| 273 | \begin{itemize}
 | |
| 274 | \item \bl{$(a^{?\{n\}}) \cdot a^{\{n\}}$}
 | |
| 275 | \item \bl{$(a^*)^*\cdot b$}
 | |
| 630 | 276 | \item \bl{$([a-z]^+)^*$}
 | 
| 560 | 277 | \item \bl{$(a + a \cdot a)^*$}
 | 
| 278 | \item \bl{$(a + a^?)^*$}
 | |
| 279 | \end{itemize}
 | |
| 280 | ||
| 281 | \item sometimes also called \alert{catastrophic backtracking}
 | |
| 282 | \item this is a problem for \alert{N}etwork \alert{I}ntrusion
 | |
| 631 | 283 |   \alert{D}etection systems, Cloudflare, StackExchange, Atom editor
 | 
| 560 | 284 | \item \url{https://vimeo.com/112065252}  
 | 
| 285 | \end{itemize}
 | |
| 286 | ||
| 287 | \end{frame}
 | |
| 288 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
| 428 
a47c4227a0c6
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
334diff
changeset | 289 | |
| 255 
96a99237fa42
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
254diff
changeset | 290 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | 
| 
96a99237fa42
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
254diff
changeset | 291 | \begin{frame}[c]
 | 
| 559 | 292 | \frametitle{The Goal of this Module}
 | 
| 293 | ||
| 294 | \begin{center}
 | |
| 295 |   \begin{tikzpicture}[scale=1,
 | |
| 296 |                       node/.style={
 | |
| 297 | rectangle,rounded corners=3mm, | |
| 298 | very thick,draw=black!50,minimum height=18mm, minimum width=20mm, | |
| 299 | top color=white,bottom color=black!20}] | |
| 300 | ||
| 560 | 301 |   \node at (3.05, 1.8) {\Large\bf write a compiler};
 | 
| 559 | 302 | |
| 560 | 303 |   \node (0) at (-2.3,0) {};  
 | 
| 304 | \node [above=5mm of 0] | |
| 305 |   {\makebox[0mm]{\footnotesize
 | |
| 306 |       \begin{tabular}{@{}l@{}}input\\[-1mm]program\end{tabular}}}; 
 | |
| 576 | 307 | |
| 559 | 308 |   \node (A) at (0,0)  [node] {};
 | 
| 309 |   \node [below right] at (A.north west) {lexer};
 | |
| 310 | ||
| 311 |   \node (B) at (3,0)  [node] {};
 | |
| 312 |   \node [below right=1mm] at (B.north west) {\mbox{}\hspace{-1mm}parser};
 | |
| 313 | ||
| 314 |   \node (C) at (6,0)  [node] {};
 | |
| 315 |   \node [below right] at (C.north west) {\mbox{}\hspace{-1mm}code gen};
 | |
| 316 | ||
| 560 | 317 |   \node (1) at (8.4,0) {};
 | 
| 318 | \node [above=5mm of 1] | |
| 319 |   {\makebox[0mm]{\footnotesize
 | |
| 320 |       \begin{tabular}{@{}r@{}}binary\\[-1mm]code\end{tabular}}};
 | |
| 559 | 321 | |
| 322 | \draw [->,line width=4mm] (0) -- (A); | |
| 323 | \draw [->,line width=4mm] (A) -- (B); | |
| 324 | \draw [->,line width=4mm] (B) -- (C); | |
| 325 | \draw [->,line width=4mm] (C) -- (1); | |
| 326 |   \end{tikzpicture}
 | |
| 327 |   \end{center}
 | |
| 328 | ||
| 329 | \only<2,3,4>{
 | |
| 330 | \begin{textblock}{1}(1,2.1)
 | |
| 331 | \begin{bubble}[9.8cm]
 | |
| 332 | \normalsize | |
| 333 | lexer input: a string\smallskip\\ | |
| 334 | \hspace{5mm}\code{"read(n);"}\medskip\\
 | |
| 335 | lexer output: a sequence of tokens\smallskip\\ | |
| 336 | \hspace{5mm}\code{key(read) lpar id(n) rpar semi}
 | |
| 337 | \end{bubble}
 | |
| 621 | 338 | \end{textblock}} 
 | 
| 559 | 339 | |
| 340 | \only<3,4>{
 | |
| 341 | \begin{textblock}{1}(6,7.8)
 | |
| 342 | \begin{tabular}{c}
 | |
| 343 | \includegraphics[scale=0.2]{../pics/rosetta.jpg}\\[-2mm]
 | |
| 344 | \footnotesize lexing $\Rightarrow$ recognising words (Stone of Rosetta) | |
| 345 | \end{tabular}
 | |
| 346 | \end{textblock}}
 | |
| 347 | ||
| 348 | \only<4>{
 | |
| 349 | \begin{textblock}{1}(0.5,12)\small
 | |
| 350 | \begin{tabular}{l@{}c@{}l}
 | |
| 351 |   \pcode{if}    & $\;\Rightarrow\;$ & keyword\\
 | |
| 352 |   \pcode{iffoo} & $\;\Rightarrow\;$ & identifier\\
 | |
| 353 | \end{tabular}  
 | |
| 354 | \end{textblock}}
 | |
| 355 | ||
| 356 | \only<5>{
 | |
| 357 | \begin{textblock}{1}(1,1.5)
 | |
| 358 | \begin{bubble}[8.5cm]
 | |
| 359 | \normalsize | |
| 360 | parser input: a sequence of tokens\smallskip\\ | |
| 361 | ||
| 362 | {\small\hspace{5mm}\code{key(read) lpar id(n) rpar semi}}\smallskip\\
 | |
| 363 | ||
| 364 | parser output: an abstract syntax tree\smallskip\\ | |
| 365 | \footnotesize | |
| 366 | \hspace{2cm}\begin{tikzpicture}
 | |
| 367 |   \node {\code{read}}
 | |
| 368 |     child {node {\code{lpar}}}
 | |
| 369 |     child {node {\code{n}}}
 | |
| 370 |     child {node {\code{rpar}}};
 | |
| 371 | \end{tikzpicture}
 | |
| 372 | \end{bubble}
 | |
| 373 | \end{textblock}}
 | |
| 374 | ||
| 375 | \only<6,7>{
 | |
| 376 | \begin{textblock}{1}(1,1.5)
 | |
| 377 | \begin{bubble}[4cm]
 | |
| 378 | \normalsize | |
| 379 | code generator:\smallskip\\ | |
| 380 | \hspace{5mm}\code{istore 2}\\ 
 | |
| 381 | \hspace{5mm}\code{iload 2}\\ 
 | |
| 382 | \hspace{5mm}\code{ldc 10}\\
 | |
| 383 | \hspace{5mm}\code{isub}\\
 | |
| 384 | \hspace{5mm}\code{ifeq Label2}\\ 
 | |
| 385 | \hspace{5mm}\code{iload 2}\\
 | |
| 386 | \hspace{5mm}\code{...}\\
 | |
| 387 | \end{bubble}
 | |
| 388 | \end{textblock}}
 | |
| 389 | ||
| 390 | \only<7>{
 | |
| 391 | \begin{textblock}{6}(8.4,7)
 | |
| 392 | \begin{bubble}[5cm]
 | |
| 393 | \mbox{\begin{tikzpicture}[scale=0.58,rounded corners=0mm]
 | |
| 394 | \begin{axis}[axis x line=bottom, axis y line=left, ylabel=secs,
 | |
| 395 | xlabel=n, | |
| 396 | enlargelimits=0.05, | |
| 397 | ybar interval=0.7, legend style=small] | |
| 398 | \addplot file {interpreted2.data};
 | |
| 399 | \addplot file {compiled2.data};
 | |
| 400 | %\legend{interpreted, compiled}
 | |
| 401 | \end{axis}
 | |
| 402 | \end{tikzpicture}}
 | |
| 403 | \end{bubble}
 | |
| 404 | \end{textblock}}
 | |
| 405 | ||
| 406 | \end{frame}
 | |
| 407 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
| 408 | ||
| 409 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
| 410 | \begin{frame}[c]
 | |
| 411 | \frametitle{The Acad.~Subject is Mature}
 | |
| 412 | ||
| 631 | 413 | \bigskip | 
| 559 | 414 | \begin{itemize}
 | 
| 631 | 415 | \item Turing Machines, 1936 (a tape as memory) | 
| 559 | 416 | \item Regular Expressions, 1956\\ | 
| 631 | 417 | \item The first compiler for COBOL, 1957\\ (Grace Hopper)\medskip | 
| 559 | 418 | \item But surprisingly research papers are still published nowadays\\ | 
| 419 | \item ``Parsing: The Solved Problem That Isn't'' | |
| 420 | \end{itemize}
 | |
| 421 | ||
| 422 | \begin{flushright}
 | |
| 423 | \includegraphics[scale=0.3]{pics/hopper.jpg}\\
 | |
| 424 | \footnotesize\textcolor{gray}{Grace Hopper}
 | |
| 425 | \end{flushright}
 | |
| 426 | ||
| 427 | ||
| 428 | \begin{flushright}
 | |
| 429 | \mbox{}\\[-6mm]
 | |
| 430 | {\footnotesize\textcolor{gray}{(she made it to David Letterman's Tonight Show,\\[-2mm]
 | |
| 722 | 431 |  \url{https://youtu.be/3N_ywhx6_K0?t=31})}}
 | 
| 559 | 432 | \end{flushright}
 | 
| 433 | ||
| 434 | \end{frame}
 | |
| 435 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
| 436 | ||
| 632 | 437 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | 
| 438 | \begin{frame}[c]
 | |
| 636 | 439 | \frametitle{Remember BF*** from PEP?}
 | 
| 559 | 440 | |
| 632 | 441 | \begin{center}
 | 
| 442 | \begin{tabular}{lcl}
 | |
| 443 | \bl{\texttt{>}} & $\Rightarrow$ & move one cell right\\
 | |
| 444 | \bl{\texttt{<}} & $\Rightarrow$ & move one cell left\\
 | |
| 445 | \bl{\texttt{+}} & $\Rightarrow$ & increase cell by one\\
 | |
| 446 | \bl{\texttt{-}} & $\Rightarrow$ & decrease cell by one\\
 | |
| 447 | \bl{\texttt{.}} & $\Rightarrow$ & print current cell\\
 | |
| 448 | \bl{\texttt{,}} & $\Rightarrow$ & input current cell\\
 | |
| 449 | \bl{\texttt{[}} & $\Rightarrow$ & loop begin\\
 | |
| 450 | \bl{\texttt{]}} & $\Rightarrow$ & loop end\medskip\\
 | |
| 451 | & $\Rightarrow$ & everything else is a comment\\ | |
| 452 | \end{tabular}  
 | |
| 453 | \end{center}  
 | |
| 454 | ||
| 455 | \end{frame}
 | |
| 456 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
| 457 | ||
| 458 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
| 459 | \begin{frame}[c]
 | |
| 636 | 460 |   \frametitle{A ``Compiler'' for BF***}
 | 
| 632 | 461 | |
| 462 |   \begin{center}
 | |
| 463 |   \begin{tabular}{lcl}
 | |
| 464 |   \bl{\texttt{>}} & $\Rightarrow$ & \texttt{ptr++}\\
 | |
| 465 |   \bl{\texttt{<}} & $\Rightarrow$ & \texttt{ptr--}\\
 | |
| 466 |   \bl{\texttt{+}} & $\Rightarrow$ & \texttt{(*ptr)++}\\
 | |
| 467 |   \bl{\texttt{-}} & $\Rightarrow$ & \texttt{(*ptr)--}\\
 | |
| 468 |   \bl{\texttt{.}} & $\Rightarrow$ & \texttt{putchar(*ptr)}\\
 | |
| 469 |   \bl{\texttt{,}} & $\Rightarrow$ & \texttt{*ptr = getchar()}\\
 | |
| 470 |   \bl{\texttt{[}} & $\Rightarrow$ & \texttt{while(*ptr)\{}\\
 | |
| 471 |   \bl{\texttt{]}} & $\Rightarrow$ & \texttt{\}}\medskip\\
 | |
| 472 | & $\Rightarrow$ & ignore everything else\\ | |
| 473 |   \end{tabular}  
 | |
| 474 |   \end{center}\bigskip  
 | |
| 475 | ||
| 476 |   \texttt{char field[30000]\\ char *ptr = &field[15000]}
 | |
| 477 | ||
| 478 | \end{frame}
 | |
| 479 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
| 480 | ||
| 559 | 481 | |
| 482 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
| 483 | \begin{frame}[c]
 | |
| 327 
9470cd124667
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
255diff
changeset | 484 | \frametitle{Lectures 1 - 5}
 | 
| 255 
96a99237fa42
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
254diff
changeset | 485 | |
| 
96a99237fa42
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
254diff
changeset | 486 | transforming strings into structured data\\[10mm] | 
| 
96a99237fa42
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
254diff
changeset | 487 | |
| 506 | 488 | {\LARGE\bf Lexing} {\hfill{}based on regular expressions}\medskip\\
 | 
| 255 
96a99237fa42
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
254diff
changeset | 489 | \hspace{5mm}(recognising ``words'')\\[6mm]
 | 
| 
96a99237fa42
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
254diff
changeset | 490 | |
| 
96a99237fa42
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
254diff
changeset | 491 | {\LARGE\bf Parsing}\medskip\\
 | 
| 
96a99237fa42
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
254diff
changeset | 492 | \hspace{5mm}(recognising ``sentences'')
 | 
| 
96a99237fa42
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
254diff
changeset | 493 | |
| 
96a99237fa42
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
254diff
changeset | 494 | \begin{textblock}{1}(10,9.1)
 | 
| 
96a99237fa42
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
254diff
changeset | 495 | \begin{tabular}{c}
 | 
| 
96a99237fa42
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
254diff
changeset | 496 | \includegraphics[scale=0.1]{../pics/rosetta.jpg}\\[-2mm]
 | 
| 
96a99237fa42
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
254diff
changeset | 497 | \footnotesize Stone of Rosetta | 
| 
96a99237fa42
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
254diff
changeset | 498 | \end{tabular}
 | 
| 
96a99237fa42
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
254diff
changeset | 499 | \end{textblock}
 | 
| 
96a99237fa42
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
254diff
changeset | 500 | |
| 
96a99237fa42
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
254diff
changeset | 501 | \end{frame}
 | 
| 
96a99237fa42
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
254diff
changeset | 502 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | 
| 
96a99237fa42
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
254diff
changeset | 503 | |
| 636 | 504 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | 
| 505 | \begin{frame}[c]
 | |
| 506 |   \frametitle{Lectures 5 - 10}
 | |
| 507 | ||
| 508 | code generation for a small imperative and a small functional languages\\[10mm] | |
| 509 | ||
| 510 |   {\LARGE\bf Interpreters}\medskip\\
 | |
| 511 |   \hspace{5mm}(directly runs a program)\\[6mm]
 | |
| 512 | ||
| 513 |   {\LARGE\bf Compilers}\medskip\\
 | |
| 514 |   \hspace{5mm}(generates JVM code)
 | |
| 515 | ||
| 516 |   \begin{textblock}{1}(10,8.1)
 | |
| 517 |   \begin{tabular}{c}
 | |
| 518 |   \includegraphics[scale=0.4]{../pics/javaduke.png}
 | |
| 519 |   \end{tabular}
 | |
| 520 |   \end{textblock}
 | |
| 521 | ||
| 522 |   \end{frame}
 | |
| 523 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
| 524 | ||
| 525 | ||
| 526 | ||
| 1 | 527 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | 
| 255 
96a99237fa42
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
254diff
changeset | 528 | \begin{frame}[t]
 | 
| 
96a99237fa42
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
254diff
changeset | 529 | \frametitle{Familiar Regular Expr.}
 | 
| 
96a99237fa42
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
254diff
changeset | 530 | \small | 
| 
96a99237fa42
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
254diff
changeset | 531 | \begin{center}
 | 
| 560 | 532 | \texttt{[a-z0-9\_$\backslash{}$.-]+ @ [a-z0-9$\backslash{}$.-]+ . [a-z$\backslash{}$.]\{2,6\}}
 | 
| 255 
96a99237fa42
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
254diff
changeset | 533 | \end{center}\smallskip
 | 
| 
96a99237fa42
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
254diff
changeset | 534 | |
| 
96a99237fa42
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
254diff
changeset | 535 | \begin{center}
 | 
| 
96a99237fa42
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
254diff
changeset | 536 | \begin{tabular}{@{}lp{8.5cm}@{}}
 | 
| 
96a99237fa42
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
254diff
changeset | 537 | \pcode{re*} & matches 0 or more times\\
 | 
| 
96a99237fa42
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
254diff
changeset | 538 | \pcode{re+} & matches 1 or more times\\
 | 
| 
96a99237fa42
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
254diff
changeset | 539 | \pcode{re?} & matches 0 or 1 times\\
 | 
| 
96a99237fa42
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
254diff
changeset | 540 | \pcode{re\{n\}}	& matches exactly \pcode{n} number of times\\
 | 
| 
96a99237fa42
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
254diff
changeset | 541 | \pcode{re\{n,m\}} & matches at least \pcode{n} and at most {\tt m} times\\
 | 
| 
96a99237fa42
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
254diff
changeset | 542 | \pcode{[...]} & matches any single character inside the brackets\\
 | 
| 
96a99237fa42
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
254diff
changeset | 543 | \pcode{[^...]} & matches any single character not inside the 
 | 
| 
96a99237fa42
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
254diff
changeset | 544 | brackets\\ | 
| 560 | 545 | \pcode{a-z A-Z} & character ranges\\
 | 
| 255 
96a99237fa42
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
254diff
changeset | 546 | \pcode{\\d} & matches digits; equivalent to \pcode{[0-9]}\\
 | 
| 
96a99237fa42
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
254diff
changeset | 547 | \pcode{.} & matches every character except newline\\
 | 
| 
96a99237fa42
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
254diff
changeset | 548 | \pcode{(re)}	& groups regular expressions and remembers 
 | 
| 
96a99237fa42
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
254diff
changeset | 549 | the matched text | 
| 
96a99237fa42
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
254diff
changeset | 550 | \end{tabular}
 | 
| 
96a99237fa42
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
254diff
changeset | 551 | \end{center}
 | 
| 
96a99237fa42
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
254diff
changeset | 552 | |
| 
96a99237fa42
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
254diff
changeset | 553 | |
| 
96a99237fa42
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
254diff
changeset | 554 | \end{frame}
 | 
| 
96a99237fa42
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
254diff
changeset | 555 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | 
| 
96a99237fa42
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
254diff
changeset | 556 | |
| 
96a99237fa42
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
254diff
changeset | 557 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | 
| 631 | 558 | %\begin{frame}[c]
 | 
| 559 | %\frametitle{Today}
 | |
| 560 | % | |
| 561 | %\begin{itemize}
 | |
| 562 | %\item While the ultimate goal is to implement a small compiler for the JVM | |
| 563 | % \ldots\bigskip | |
| 564 | %\end{itemize}
 | |
| 565 | % | |
| 566 | %Let's start with: | |
| 567 | % | |
| 568 | %\begin{itemize}
 | |
| 569 | %\item a web-crawler | |
| 570 | %\item an email harvester | |
| 559 | 571 | %\item \textcolor{gray}{(a web-scraper)}
 | 
| 631 | 572 | %\end{itemize}
 | 
| 573 | % | |
| 574 | %\end{frame}
 | |
| 255 
96a99237fa42
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
254diff
changeset | 575 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | 
| 0 | 576 | |
| 2 | 577 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | 
| 631 | 578 | %\begin{frame}[t]
 | 
| 579 | %\frametitle{A Web-Crawler}
 | |
| 580 | % | |
| 581 | %\mbox{}\\[10mm]
 | |
| 582 | % | |
| 583 | %\begin{enumerate}
 | |
| 584 | %\item given an URL, read the corresponding webpage | |
| 585 | %\item extract all links from it | |
| 586 | %\item call the web-crawler again for all these links | |
| 587 | %\end{enumerate}
 | |
| 588 | % | |
| 589 | %\end{frame}
 | |
| 2 | 590 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | 
| 591 | ||
| 592 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
| 631 | 593 | %\begin{frame}[t]
 | 
| 594 | %\frametitle{A Web-Crawler}
 | |
| 595 | % | |
| 596 | %\mbox{}\\[10mm]
 | |
| 597 | % | |
| 598 | % | |
| 599 | %\begin{enumerate}
 | |
| 600 | %\item given an URL, read the corresponding webpage | |
| 601 | %\item if not possible print, out a problem | |
| 602 | %\item if possible, extract all links from it | |
| 603 | %\item call the web-crawler again for all these links | |
| 604 | %\end{enumerate}\bigskip\pause
 | |
| 605 | % | |
| 606 | %\small (we need a bound for the number of recursive calls) | |
| 607 | % | |
| 608 | %\small (the purpose is to check all links on my own webpage) | |
| 609 | %\end{frame}
 | |
| 2 | 610 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | 
| 611 | ||
| 255 
96a99237fa42
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
254diff
changeset | 612 | |
| 
96a99237fa42
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
254diff
changeset | 613 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | 
| 631 | 614 | %\begin{frame}[c]
 | 
| 615 | % | |
| 616 | %\begin{textblock}{1}(2,5)
 | |
| 617 | %\begin{tabular}{c}
 | |
| 618 | %\includegraphics[scale=0.15]{pics/servers.png}\\[-2mm]
 | |
| 619 | %\small Server | |
| 620 | %\end{tabular}
 | |
| 621 | %\end{textblock}
 | |
| 622 | % | |
| 623 | %\begin{textblock}{1}(5.6,4)
 | |
| 624 | %  \begin{tikzpicture}[scale=1.1]
 | |
| 625 | %  \draw[white] (0,1) node (X) {};
 | |
| 626 | %  \draw[white] (2,1) node (Y) {};
 | |
| 627 | %   \draw[white] (0,0) node (X1) {};
 | |
| 628 | %  \draw[white] (2,0) node (Y1) {};
 | |
| 629 | %   \draw[white] (0,-1) node (X2) {};
 | |
| 630 | %  \draw[white] (2,-1) node (Y2) {};
 | |
| 631 | % \draw[red, <-, line width = 2mm] (X) -- (Y); | |
| 632 | %  \node [inner sep=5pt,label=above:\textcolor{black}{GET request}] at ($ (X)!.5!(Y) $) {};
 | |
| 633 | % \draw[red, ->, line width = 2mm] (X1) -- (Y1); | |
| 634 | %  \node [inner sep=5pt,label=above:\textcolor{black}{webpage}] at ($ (X1)!.5!(Y1) $) {};
 | |
| 635 | % \draw[red, <-, line width = 2mm] (X2) -- (Y2); | |
| 636 | %  \node [inner sep=7pt,label=above:\textcolor{black}{POST data}] at ($ (X2)!.5!(Y2) $) {};
 | |
| 637 | %  \end{tikzpicture}
 | |
| 638 | %\end{textblock}
 | |
| 639 | % | |
| 640 | % | |
| 641 | %\begin{textblock}{1}(9,5.5)
 | |
| 642 | %\begin{tabular}{c}
 | |
| 643 | %\includegraphics[scale=0.15]{pics/laptop.png}\\[-2mm]
 | |
| 644 | %\small Browser | |
| 645 | %\end{tabular}
 | |
| 646 | %\end{textblock}
 | |
| 647 | %\end{frame}
 | |
| 648 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
| 255 
96a99237fa42
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
254diff
changeset | 649 | |
| 
96a99237fa42
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
254diff
changeset | 650 | |
| 
96a99237fa42
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
254diff
changeset | 651 | |
| 0 | 652 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | 
| 631 | 653 | %\begin{frame}[c]
 | 
| 654 | %\frametitle{Scala}
 | |
| 655 | % | |
| 656 | %\small A simple Scala function for reading webpages: | |
| 657 | %\bigskip | |
| 658 | % | |
| 659 | %\footnotesize | |
| 660 | %\lstinputlisting{../progs/app0.scala}
 | |
| 661 | %\medskip\pause | |
| 662 | % | |
| 663 | %\lstinline{get_page("""https://nms.kcl.ac.uk/christian.urban/""")}
 | |
| 664 | %\bigskip\medskip\pause | |
| 665 | % | |
| 666 | % | |
| 667 | %\small A slightly more complicated version for handling errors: | |
| 668 | %\smallskip | |
| 669 | % | |
| 670 | %\footnotesize | |
| 671 | %\lstinputlisting[xleftmargin=-4mm]{../progs/app1.scala}
 | |
| 672 | % | |
| 673 | % | |
| 674 | %\end{frame}
 | |
| 0 | 675 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | 
| 676 | ||
| 98 
1f3d89fe9820
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
97diff
changeset | 677 | |
| 
1f3d89fe9820
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
97diff
changeset | 678 | |
| 
1f3d89fe9820
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
97diff
changeset | 679 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | 
| 3 | 680 | \begin{frame}[t]
 | 
| 253 
75c469893514
added coursework
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
252diff
changeset | 681 | \frametitle{A Regular Expression}
 | 
| 3 | 682 | |
| 683 | \begin{itemize}
 | |
| 684 | \item \ldots{} is a pattern or template for specifying strings
 | |
| 685 | \end{itemize}\bigskip
 | |
| 686 | ||
| 687 | \begin{center}  
 | |
| 254 
dcd4688690ce
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
253diff
changeset | 688 | \only<1>{\scode{"https?://[^"]*"}}%
 | 
| 
dcd4688690ce
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
253diff
changeset | 689 | \only<2>{\scode{""""https?://[^"]*"""".r}}
 | 
| 3 | 690 | \end{center}\bigskip\bigskip
 | 
| 691 | ||
| 254 
dcd4688690ce
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
253diff
changeset | 692 | matches for example\smallskip\\ | 
| 
dcd4688690ce
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
253diff
changeset | 693 | \hspace{2mm}\code{"http://www.foobar.com"}\\
 | 
| 559 | 694 | \hspace{2mm}\code{"https://www.tls.org"}\smallskip\\
 | 
| 695 | ||
| 696 | but not\smallskip\\ | |
| 697 | \hspace{2mm}\code{"http://www."foo"bar.com"}\\
 | |
| 3 | 698 | |
| 253 
75c469893514
added coursework
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
252diff
changeset | 699 | \end{frame}
 | 
| 3 | 700 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | 
| 701 | ||
| 702 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
| 632 | 703 | %\begin{frame}[c]
 | 
| 704 | %\frametitle{Finding Operations in Scala}
 | |
| 705 | % | |
| 706 | %{\bf\code{rexp.findAllIn(string)}}\medskip
 | |
| 707 | % | |
| 708 | %returns a list of all (sub)strings that match the | |
| 709 | %regular expression | |
| 710 | %\bigskip\bigskip | |
| 711 | % | |
| 712 | % | |
| 713 | %{\bf\code{rexp.findFirstIn(string)}}\medskip
 | |
| 714 | % | |
| 715 | %returns either | |
| 716 | % | |
| 717 | %\begin{itemize}
 | |
| 718 | %\item \code{None} if no (sub)string matches or 
 | |
| 719 | %\item \code{Some(s)} with the first (sub)string
 | |
| 720 | %\end{itemize}
 | |
| 721 | % | |
| 722 | %\end{frame}
 | |
| 0 | 723 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | 
| 724 | ||
| 725 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
| 631 | 726 | %\begin{frame}[c]
 | 
| 727 | % | |
| 728 | %\footnotesize | |
| 729 | %\lstinputlisting{../progs/app2.scala}
 | |
| 730 | % | |
| 731 | %\end{frame}
 | |
| 254 
dcd4688690ce
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
253diff
changeset | 732 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | 
| 0 | 733 | |
| 254 
dcd4688690ce
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
253diff
changeset | 734 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | 
| 631 | 735 | %\begin{frame}[c]
 | 
| 736 | % | |
| 737 | %\small | |
| 738 | %A version that only crawls links in ``my'' domain:\bigskip | |
| 739 | % | |
| 740 | %\footnotesize | |
| 741 | %\lstinputlisting{../progs/app3.scala}
 | |
| 742 | % | |
| 743 | %\end{frame}
 | |
| 0 | 744 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | 
| 745 | ||
| 746 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
| 631 | 747 | %\begin{frame}[c]
 | 
| 748 | %\lstset{xleftmargin=-4mm}
 | |
| 749 | %\small | |
| 750 | %A little email harvester: | |
| 751 | % | |
| 752 | %\footnotesize | |
| 753 | %\lstinputlisting{../progs/app4.scala}\bigskip
 | |
| 754 | % | |
| 755 | %\tiny | |
| 756 | %\url{http://net.tutsplus.com/tutorials/other/8-regular-expressions-you-should-know/}
 | |
| 757 | % | |
| 758 | %\end{frame}
 | |
| 3 | 759 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | 
| 760 | ||
| 761 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
| 14 | 762 | \begin{frame}[t]
 | 
| 506 | 763 | \frametitle{Regular Expressions}
 | 
| 0 | 764 | |
| 330 
0806e45d873c
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
328diff
changeset | 765 | Their inductive definition: | 
| 
0806e45d873c
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
328diff
changeset | 766 | |
| 14 | 767 | |
| 330 
0806e45d873c
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
328diff
changeset | 768 | \begin{textblock}{6}(2,7.5)
 | 
| 
0806e45d873c
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
328diff
changeset | 769 |   \begin{tabular}{@ {}rrl@ {\hspace{13mm}}l}
 | 
| 512 | 770 |   \bl{$r$} & \bl{$::=$}  & \bl{$\ZERO$}  & nothing\\
 | 
| 428 
a47c4227a0c6
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
334diff
changeset | 771 |          & \bl{$\mid$} & \bl{$\ONE$}       & empty string / \pcode{""} / $[]$\\
 | 
| 330 
0806e45d873c
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
328diff
changeset | 772 |          & \bl{$\mid$} & \bl{$c$}                         & character\\
 | 
| 
0806e45d873c
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
328diff
changeset | 773 |          & \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 | 774 |          & \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 | 775 |          & \bl{$\mid$} & \bl{$r^*$}            & star (zero or more)\\
 | 
| 3 | 776 |   \end{tabular}
 | 
| 777 |   \end{textblock}
 | |
| 778 | ||
| 330 
0806e45d873c
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
328diff
changeset | 779 | |
| 
0806e45d873c
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
328diff
changeset | 780 | \only<2->{\footnotesize
 | 
| 
0806e45d873c
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
328diff
changeset | 781 | \begin{textblock}{9}(2,0.5)
 | 
| 
0806e45d873c
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
328diff
changeset | 782 | \begin{bubble}[9.8cm]
 | 
| 
0806e45d873c
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
328diff
changeset | 783 | \lstinputlisting{../progs/app01.scala}
 | 
| 
0806e45d873c
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
328diff
changeset | 784 | \end{bubble}
 | 
| 
0806e45d873c
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
328diff
changeset | 785 | \end{textblock}}
 | 
| 
0806e45d873c
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
328diff
changeset | 786 | |
| 254 
dcd4688690ce
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
253diff
changeset | 787 | \end{frame}
 | 
| 3 | 788 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | 
| 789 | ||
| 790 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
| 506 | 791 | %\begin{frame}[t]
 | 
| 792 | %\frametitle{Regular Expressions}
 | |
| 793 | % | |
| 794 | %\small | |
| 795 | %In Scala:\bigskip | |
| 796 | % | |
| 797 | %\footnotesize | |
| 798 | %\lstinputlisting{../progs/app51.scala}
 | |
| 799 | % | |
| 800 | % | |
| 801 | %\end{frame}
 | |
| 0 | 802 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | 
| 803 | ||
| 804 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
| 255 
96a99237fa42
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
254diff
changeset | 805 | \begin{frame}[t]
 | 
| 
96a99237fa42
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
254diff
changeset | 806 | \frametitle{Strings}
 | 
| 
96a99237fa42
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
254diff
changeset | 807 | |
| 
96a99237fa42
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
254diff
changeset | 808 | \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 | 809 | |
| 
96a99237fa42
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
254diff
changeset | 810 | \begin{center}
 | 
| 330 
0806e45d873c
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
328diff
changeset | 811 | \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 | 812 | \end{center}
 | 
| 
96a99237fa42
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
254diff
changeset | 813 | |
| 330 
0806e45d873c
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
328diff
changeset | 814 | 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 | 815 | |
| 
96a99237fa42
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
254diff
changeset | 816 | the concatenation of two strings: | 
| 
96a99237fa42
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
254diff
changeset | 817 | |
| 
96a99237fa42
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
254diff
changeset | 818 | \begin{center}
 | 
| 
96a99237fa42
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
254diff
changeset | 819 | \bl{$s_1 \,@\, s_2$}
 | 
| 
96a99237fa42
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
254diff
changeset | 820 | \end{center}
 | 
| 
96a99237fa42
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
254diff
changeset | 821 | |
| 631 | 822 | \bl{\textit{foo $@$ bar = foobar}}\\
 | 
| 823 | \bl{\textit{baz $@\, []$ = baz}}
 | |
| 255 
96a99237fa42
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
254diff
changeset | 824 | |
| 
96a99237fa42
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
254diff
changeset | 825 | \end{frame}
 | 
| 
96a99237fa42
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
254diff
changeset | 826 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | 
| 
96a99237fa42
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
254diff
changeset | 827 | |
| 
96a99237fa42
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
254diff
changeset | 828 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | 
| 330 
0806e45d873c
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
328diff
changeset | 829 | \begin{frame}[c]
 | 
| 
0806e45d873c
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
328diff
changeset | 830 | \frametitle{Languages, Strings}
 | 
| 
0806e45d873c
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
328diff
changeset | 831 | |
| 
0806e45d873c
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
328diff
changeset | 832 | \begin{itemize}
 | 
| 
0806e45d873c
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
328diff
changeset | 833 | \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 | 834 | \begin{center}
 | 
| 
0806e45d873c
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
328diff
changeset | 835 | \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 | 836 | \end{center}\bigskip
 | 
| 
0806e45d873c
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
328diff
changeset | 837 | |
| 
0806e45d873c
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
328diff
changeset | 838 | |
| 
0806e45d873c
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
328diff
changeset | 839 | \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 | 840 | \begin{center}
 | 
| 
0806e45d873c
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
328diff
changeset | 841 | \bl{$\{[], hello, \textit{foobar}, a, abc\}$}
 | 
| 
0806e45d873c
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
328diff
changeset | 842 | \end{center}\bigskip
 | 
| 
0806e45d873c
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
328diff
changeset | 843 | |
| 332 
4755ad4b457b
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
331diff
changeset | 844 | \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 | 845 | |
| 
0806e45d873c
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
328diff
changeset | 846 | \begin{center}
 | 
| 
0806e45d873c
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
328diff
changeset | 847 | \begin{tabular}{rcl}
 | 
| 
0806e45d873c
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
328diff
changeset | 848 | \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 | 849 | \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 | 850 | \end{tabular}
 | 
| 
0806e45d873c
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
328diff
changeset | 851 | \end{center}
 | 
| 
0806e45d873c
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
328diff
changeset | 852 | |
| 
0806e45d873c
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
328diff
changeset | 853 | %\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 | 854 | % strings, or language. | 
| 
0806e45d873c
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
328diff
changeset | 855 | \end{itemize}  
 | 
| 
0806e45d873c
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
328diff
changeset | 856 | |
| 
0806e45d873c
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
328diff
changeset | 857 | \end{frame}
 | 
| 
0806e45d873c
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
328diff
changeset | 858 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | 
| 
0806e45d873c
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
328diff
changeset | 859 | |
| 
0806e45d873c
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
328diff
changeset | 860 | |
| 
0806e45d873c
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
328diff
changeset | 861 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | 
| 0 | 862 | \mode<presentation>{
 | 
| 863 | \begin{frame}[c]
 | |
| 253 
75c469893514
added coursework
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
252diff
changeset | 864 | \frametitle{\begin{tabular}{c}The Meaning of a\\[-2mm] 
 | 
| 
75c469893514
added coursework
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
252diff
changeset | 865 |   Regular Expression\end{tabular}}
 | 
| 0 | 866 | |
| 4 | 867 | \begin{textblock}{15}(1,4)
 | 
| 254 
dcd4688690ce
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
253diff
changeset | 868 |  \begin{tabular}{rcl}
 | 
| 428 
a47c4227a0c6
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
334diff
changeset | 869 |  \bl{$L(\ZERO)$}  & \bl{$\dn$} & \bl{$\{\}$}\\
 | 
| 
a47c4227a0c6
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
334diff
changeset | 870 |  \bl{$L(\ONE)$}     & \bl{$\dn$} & \bl{$\{[]\}$}\\
 | 
| 254 
dcd4688690ce
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
253diff
changeset | 871 |  \bl{$L(c)$}            & \bl{$\dn$} & \bl{$\{[c]\}$}\\
 | 
| 
dcd4688690ce
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
253diff
changeset | 872 |  \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 | 873 |  \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 | 874 |  \bl{$L(r^*)$}           & \bl{$\dn$} & \onslide<4->{\bl{$\bigcup_{0 \le n} L(r)^n$}}\\
 | 
| 4 | 875 |   \end{tabular}\bigskip
 | 
| 3 | 876 | |
| 4 | 877 | \onslide<2->{
 | 
| 254 
dcd4688690ce
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
253diff
changeset | 878 | \hspace{5mm}\bl{$L(r)^0 \;\dn\; \{[]\}$}\\
 | 
| 
dcd4688690ce
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
253diff
changeset | 879 | \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 | 880 | \small\hspace{5cm}\textcolor{gray}{$\{ s_1 @ s_2 \;|\; s_1\in L(r) \wedge s_2 \in L(r)^n \}$}}
 | 
| 4 | 881 | } | 
| 882 |     \end{textblock}
 | |
| 883 | ||
| 0 | 884 | \end{frame}}
 | 
| 885 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
| 886 | ||
| 5 | 887 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | 
| 888 | \begin{frame}[c]
 | |
| 254 
dcd4688690ce
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
253diff
changeset | 889 | \frametitle{The Meaning of Matching}
 | 
| 5 | 890 | |
| 254 
dcd4688690ce
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
253diff
changeset | 891 | \begin{bubble}[10cm]
 | 
| 559 | 892 | \large\bf | 
| 507 | 893 | 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 | 894 | provided | 
| 5 | 895 | |
| 896 | \begin{center}
 | |
| 254 
dcd4688690ce
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
253diff
changeset | 897 | \bl{$s \in L(r)$}\\ 
 | 
| 5 | 898 | \end{center}
 | 
| 330 
0806e45d873c
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
328diff
changeset | 899 | \end{bubble}\bigskip\bigskip
 | 
| 
0806e45d873c
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
328diff
changeset | 900 | |
| 
0806e45d873c
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
328diff
changeset | 901 | \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 | 902 | 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 | 903 | Ruby, Java) | 
| 5 | 904 | |
| 254 
dcd4688690ce
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
253diff
changeset | 905 | \end{frame}
 | 
| 5 | 906 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | 
| 907 | ||
| 631 | 908 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | 
| 909 | \begin{frame}[c]
 | |
| 910 |   \frametitle{The Power Operation}
 | |
| 911 | ||
| 912 |   \begin{itemize}
 | |
| 913 |   \item The \alert{\textbf{\boldmath$n$th Power}} of a language:
 | |
| 914 | ||
| 915 |   \begin{center}
 | |
| 916 |   \begin{tabular}{lcl}
 | |
| 917 |   \bl{$A^0$}    & \bl{$\dn$} & \bl{$\{[]\}$}\\
 | |
| 918 |   \bl{$A^{n+1}$} & \bl{$\dn$} & \bl{$A \,@\, A^n$}
 | |
| 919 |   \end{tabular}
 | |
| 920 |   \end{center}\bigskip
 | |
| 921 | ||
| 922 | \item[] For example | |
| 923 | ||
| 924 |   \begin{center}
 | |
| 925 |   \begin{tabular}{lcl@{\hspace{10mm}}l}
 | |
| 926 |   \bl{$A^4$} & \bl{$=$} & \bl{$A \,@\, A \,@\, A \,@\, A$} & \bl{$(@\,\{[]\})$}\\
 | |
| 927 |   \bl{$A^1$} & \bl{$=$} & \bl{$A$} & \bl{$(@\,\{[]\})$}\\
 | |
| 928 |   \bl{$A^0$} & \bl{$=$} & \bl{$\{[]\}$}\\
 | |
| 929 |   \end{tabular}
 | |
| 930 |   \end{center}
 | |
| 931 | ||
| 932 |   \end{itemize}  
 | |
| 933 | ||
| 934 |   \end{frame}
 | |
| 935 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
| 936 | ||
| 937 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
| 938 | \begin{frame}[c]
 | |
| 939 |   \frametitle{Questions}
 | |
| 940 | ||
| 941 |   \begin{itemize}
 | |
| 942 |   \item Say \bl{$A = \{[a],[b],[c],[d]\}$}.\bigskip
 | |
| 943 | ||
| 944 | \item[] | |
| 945 |   How many strings are in \bl{$A^4$}\,?
 | |
| 946 | \bigskip\medskip\pause | |
| 947 | ||
| 948 | ||
| 949 | \item[] | |
| 950 |   What if \bl{$A = \{[a],[b],[c],[]\}$};\\ 
 | |
| 951 |   how many strings are then in \bl{$A^4$}\,?
 | |
| 952 |   \end{itemize}  
 | |
| 953 | ||
| 954 | \end{frame}
 | |
| 955 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
| 956 | ||
| 957 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
| 958 | \begin{frame}[c]
 | |
| 959 |   \frametitle{The Star Operation}
 | |
| 960 | ||
| 961 |   \begin{itemize}
 | |
| 962 |   \item The \alert{\bf Kleene Star} of a \underline{language}:
 | |
| 963 | \bigskip | |
| 964 | ||
| 965 |   \begin{center}
 | |
| 966 |   \begin{tabular}{c}
 | |
| 967 |   \bl{$A\star \dn \bigcup_{0\le n} A^n$}
 | |
| 968 |   \end{tabular}
 | |
| 969 |   \end{center}\bigskip
 | |
| 970 | ||
| 971 | \item[] This expands to | |
| 972 | ||
| 973 | \[ | |
| 974 |   \bl{A^0 \cup A^1 \cup A^2 \cup A^3 \cup A^4 \cup \ldots}
 | |
| 975 | \] | |
| 976 | ||
| 977 | or | |
| 978 | ||
| 979 | \small | |
| 980 | \[ | |
| 981 |   \bl{\{[]\} \;\cup\; A \;\cup\; A\,@\,A \;\cup\; 
 | |
| 982 | A\,@\,A\,@\,A \;\cup\; A\,@\,A\,@\,A\,@\,A \cup \ldots} | |
| 983 | \] | |
| 984 | ||
| 985 |   \end{itemize}  
 | |
| 986 | ||
| 987 |   \end{frame}
 | |
| 988 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
| 989 | ||
| 990 | ||
| 0 | 991 | |
| 992 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
| 993 | \begin{frame}[c]
 | |
| 253 
75c469893514
added coursework
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
252diff
changeset | 994 | \frametitle{Written Exam}
 | 
| 
75c469893514
added coursework
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
252diff
changeset | 995 | |
| 
75c469893514
added coursework
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
252diff
changeset | 996 | \begin{itemize}
 | 
| 428 
a47c4227a0c6
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
334diff
changeset | 997 | \item Accounts for 80\%.\bigskip | 
| 253 
75c469893514
added coursework
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
252diff
changeset | 998 | |
| 559 | 999 | \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 | 1000 | 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 | 1001 | |
| 
75c469893514
added coursework
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
252diff
changeset | 1002 | \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 | 1003 |       ``\textit{optional}'') is relevant for the exam.\bigskip
 | 
| 
0806e45d873c
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
328diff
changeset | 1004 | |
| 
0806e45d873c
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
328diff
changeset | 1005 | \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 | 1006 | notation and Scala. | 
| 253 
75c469893514
added coursework
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
252diff
changeset | 1007 | \end{itemize}
 | 
| 
75c469893514
added coursework
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
252diff
changeset | 1008 | |
| 
75c469893514
added coursework
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
252diff
changeset | 1009 | \end{frame}
 | 
| 
75c469893514
added coursework
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
252diff
changeset | 1010 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | 
| 
75c469893514
added coursework
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
252diff
changeset | 1011 | |
| 
75c469893514
added coursework
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
252diff
changeset | 1012 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | 
| 
75c469893514
added coursework
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
252diff
changeset | 1013 | \begin{frame}[t]
 | 
| 
75c469893514
added coursework
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
252diff
changeset | 1014 | \frametitle{Coursework}
 | 
| 0 | 1015 | |
| 1016 | \begin{itemize}
 | |
| 428 
a47c4227a0c6
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
334diff
changeset | 1017 | \item Accounts for 20\%. Two strands. Choose \alert{\bf one}!\bigskip
 | 
| 0 | 1018 | \end{itemize}
 | 
| 1019 | ||
| 255 
96a99237fa42
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
254diff
changeset | 1020 | \begin{columns}[t]
 | 
| 
96a99237fa42
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
254diff
changeset | 1021 | \begin{column}{.5\textwidth}
 | 
| 
96a99237fa42
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
254diff
changeset | 1022 | \underline{\bf Strand 1}\medskip
 | 
| 253 
75c469893514
added coursework
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
252diff
changeset | 1023 | \begin{itemize}
 | 
| 631 | 1024 | \item 4 programming tasks: | 
| 253 
75c469893514
added coursework
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
252diff
changeset | 1025 | \begin{itemize}
 | 
| 631 | 1026 | \item matcher (4\%, 11.10.) | 
| 1027 | \item lexer (5\%, 04.11.) | |
| 1028 | \item parser (5\%, 22.11.) | |
| 1029 | \item compiler (6\%, 13.12.) | |
| 253 
75c469893514
added coursework
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
252diff
changeset | 1030 | \end{itemize}
 | 
| 631 | 1031 | \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 | 1032 | \end{itemize}
 | 
| 
75c469893514
added coursework
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
252diff
changeset | 1033 | \end{column}
 | 
| 
75c469893514
added coursework
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
252diff
changeset | 1034 | |
| 
75c469893514
added coursework
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
252diff
changeset | 1035 | \hspace{-45pt}\vrule{}\hspace{10pt}
 | 
| 255 
96a99237fa42
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
254diff
changeset | 1036 | \begin{column}{.5\textwidth}
 | 
| 
96a99237fa42
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
254diff
changeset | 1037 | \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 | 1038 | \item one task: prove the correctness of a regular expression matcher in | 
| 559 | 1039 | the \underline{Isabelle} theorem prover
 | 
| 631 | 1040 | \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 | 1041 | \end{itemize}
 | 
| 
75c469893514
added coursework
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
252diff
changeset | 1042 | \end{column}
 | 
| 
75c469893514
added coursework
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
252diff
changeset | 1043 | \end{columns}\medskip
 | 
| 
75c469893514
added coursework
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
252diff
changeset | 1044 | |
| 
75c469893514
added coursework
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
252diff
changeset | 1045 | \small | 
| 
75c469893514
added coursework
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
252diff
changeset | 1046 | \begin{itemize}
 | 
| 
75c469893514
added coursework
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
252diff
changeset | 1047 | \item Solving more than one strand will {\bf not} give you more 
 | 
| 506 | 1048 | marks. | 
| 1049 | ||
| 253 
75c469893514
added coursework
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
252diff
changeset | 1050 | \end{itemize}
 | 
| 
75c469893514
added coursework
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
252diff
changeset | 1051 | |
| 
75c469893514
added coursework
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
252diff
changeset | 1052 | \end{frame}
 | 
| 0 | 1053 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | 
| 1054 | ||
| 255 
96a99237fa42
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
254diff
changeset | 1055 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | 
| 
96a99237fa42
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
254diff
changeset | 1056 | \begin{frame}[c]
 | 
| 506 | 1057 | \frametitle{Lecture Capture}
 | 
| 1058 | ||
| 1059 | \begin{itemize}
 | |
| 559 | 1060 | \item Hope it works\ldots\pause actually no, it does not!\medskip\pause | 
| 1061 | \item It is important to use lecture capture wisely\\ (it is only the ``baseline''): | |
| 506 | 1062 | \begin{itemize}  
 | 
| 1063 | \item Lecture recordings are a study and revision aid. | |
| 1064 | \item Statistically, there is a clear and direct link between attendance and | |
| 637 | 1065 | attainment: students who do not attend lectures, do less well in exams. | 
| 506 | 1066 | \end{itemize}
 | 
| 1067 | ||
| 1068 | \item Attending a lecture is more than watching it online -- if you do not | |
| 1069 | attend, you miss out! | |
| 1070 | ||
| 1071 | \end{itemize}
 | |
| 1072 | ||
| 1073 | \end{frame}
 | |
| 1074 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
| 1075 | ||
| 1076 | ||
| 1077 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
| 1078 | \begin{frame}[c]
 | |
| 255 
96a99237fa42
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
254diff
changeset | 1079 | \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 | 1080 | |
| 
96a99237fa42
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
254diff
changeset | 1081 | \mbox{}
 | 
| 
96a99237fa42
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
254diff
changeset | 1082 | \end{frame}
 | 
| 
96a99237fa42
updated
 Christian Urban <christian dot urban at kcl dot ac dot uk> parents: 
254diff
changeset | 1083 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | 
| 0 | 1084 | \end{document}
 | 
| 1085 | ||
| 1086 | %%% Local Variables: | |
| 1087 | %%% mode: latex | |
| 1088 | %%% TeX-master: t | |
| 1089 | %%% End: | |
| 1090 |