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