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