slides01.tex
author Chengsong
Sun, 05 May 2019 22:02:29 +0100
changeset 15 cd0ceaf89c1d
child 16 c51178fa85fe
permissions -rw-r--r--
hello
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
15
Chengsong
parents:
diff changeset
     1
\documentclass[dvipsnames,14pt,t,xelatex]{beamer}
Chengsong
parents:
diff changeset
     2
\usepackage{./slides}
Chengsong
parents:
diff changeset
     3
\usepackage{./graph}
Chengsong
parents:
diff changeset
     4
\usepackage{./langs}
Chengsong
parents:
diff changeset
     5
\usepackage{./data}
Chengsong
parents:
diff changeset
     6
Chengsong
parents:
diff changeset
     7
\hfuzz=220pt 
Chengsong
parents:
diff changeset
     8
Chengsong
parents:
diff changeset
     9
\lstset{language=Scala,
Chengsong
parents:
diff changeset
    10
        style=mystyle,
Chengsong
parents:
diff changeset
    11
        numbersep=0pt,
Chengsong
parents:
diff changeset
    12
        numbers=none,
Chengsong
parents:
diff changeset
    13
        xleftmargin=0mm}
Chengsong
parents:
diff changeset
    14
Chengsong
parents:
diff changeset
    15
\newcommand{\bl}[1]{\textcolor{blue}{#1}}     
Chengsong
parents:
diff changeset
    16
 
Chengsong
parents:
diff changeset
    17
% beamer stuff 
Chengsong
parents:
diff changeset
    18
\renewcommand{\slidecaption}{CFL 01, King's College London}
Chengsong
parents:
diff changeset
    19
Chengsong
parents:
diff changeset
    20
Chengsong
parents:
diff changeset
    21
\begin{filecontents}{re-python2.data}
Chengsong
parents:
diff changeset
    22
1 0.033
Chengsong
parents:
diff changeset
    23
5 0.036
Chengsong
parents:
diff changeset
    24
10 0.034
Chengsong
parents:
diff changeset
    25
15 0.036
Chengsong
parents:
diff changeset
    26
18 0.059
Chengsong
parents:
diff changeset
    27
19 0.084 
Chengsong
parents:
diff changeset
    28
20 0.141
Chengsong
parents:
diff changeset
    29
21 0.248
Chengsong
parents:
diff changeset
    30
22 0.485
Chengsong
parents:
diff changeset
    31
23 0.878
Chengsong
parents:
diff changeset
    32
24 1.71
Chengsong
parents:
diff changeset
    33
25 3.40
Chengsong
parents:
diff changeset
    34
26 7.08
Chengsong
parents:
diff changeset
    35
27 14.12
Chengsong
parents:
diff changeset
    36
28 26.69
Chengsong
parents:
diff changeset
    37
\end{filecontents}
Chengsong
parents:
diff changeset
    38
Chengsong
parents:
diff changeset
    39
\begin{filecontents}{re-java.data}
Chengsong
parents:
diff changeset
    40
5  0.00298
Chengsong
parents:
diff changeset
    41
10  0.00418
Chengsong
parents:
diff changeset
    42
15  0.00996
Chengsong
parents:
diff changeset
    43
16  0.01710
Chengsong
parents:
diff changeset
    44
17  0.03492
Chengsong
parents:
diff changeset
    45
18  0.03303
Chengsong
parents:
diff changeset
    46
19  0.05084
Chengsong
parents:
diff changeset
    47
20  0.10177
Chengsong
parents:
diff changeset
    48
21  0.19960
Chengsong
parents:
diff changeset
    49
22  0.41159
Chengsong
parents:
diff changeset
    50
23  0.82234
Chengsong
parents:
diff changeset
    51
24  1.70251
Chengsong
parents:
diff changeset
    52
25  3.36112
Chengsong
parents:
diff changeset
    53
26  6.63998
Chengsong
parents:
diff changeset
    54
27  13.35120
Chengsong
parents:
diff changeset
    55
28  29.81185
Chengsong
parents:
diff changeset
    56
\end{filecontents} 
Chengsong
parents:
diff changeset
    57
Chengsong
parents:
diff changeset
    58
\begin{filecontents}{re-java9.data}
Chengsong
parents:
diff changeset
    59
1000  0.01410
Chengsong
parents:
diff changeset
    60
2000  0.04882
Chengsong
parents:
diff changeset
    61
3000  0.10609
Chengsong
parents:
diff changeset
    62
4000  0.17456
Chengsong
parents:
diff changeset
    63
5000  0.27530
Chengsong
parents:
diff changeset
    64
6000  0.41116
Chengsong
parents:
diff changeset
    65
7000  0.53741
Chengsong
parents:
diff changeset
    66
8000  0.70261
Chengsong
parents:
diff changeset
    67
9000  0.93981
Chengsong
parents:
diff changeset
    68
10000 0.97419
Chengsong
parents:
diff changeset
    69
11000 1.28697
Chengsong
parents:
diff changeset
    70
12000 1.51387
Chengsong
parents:
diff changeset
    71
14000 2.07079
Chengsong
parents:
diff changeset
    72
16000 2.69846
Chengsong
parents:
diff changeset
    73
20000 4.41823
Chengsong
parents:
diff changeset
    74
24000 6.46077
Chengsong
parents:
diff changeset
    75
26000 7.64373
Chengsong
parents:
diff changeset
    76
30000 9.99446
Chengsong
parents:
diff changeset
    77
34000 12.966885
Chengsong
parents:
diff changeset
    78
38000 16.281621
Chengsong
parents:
diff changeset
    79
42000 19.180228
Chengsong
parents:
diff changeset
    80
46000 21.984721
Chengsong
parents:
diff changeset
    81
50000 26.950203
Chengsong
parents:
diff changeset
    82
60000 43.0327746
Chengsong
parents:
diff changeset
    83
\end{filecontents}
Chengsong
parents:
diff changeset
    84
Chengsong
parents:
diff changeset
    85
Chengsong
parents:
diff changeset
    86
Chengsong
parents:
diff changeset
    87
\begin{document}
Chengsong
parents:
diff changeset
    88
Chengsong
parents:
diff changeset
    89
Chengsong
parents:
diff changeset
    90
Chengsong
parents:
diff changeset
    91
Chengsong
parents:
diff changeset
    92
Chengsong
parents:
diff changeset
    93
Chengsong
parents:
diff changeset
    94
Chengsong
parents:
diff changeset
    95
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Chengsong
parents:
diff changeset
    96
\begin{frame}[t]
Chengsong
parents:
diff changeset
    97
\frametitle{%  
Chengsong
parents:
diff changeset
    98
  \begin{tabular}{@ {}c@ {}}
Chengsong
parents:
diff changeset
    99
  \\[-3mm]
Chengsong
parents:
diff changeset
   100
  \LARGE Compilers and \\[-1mm] 
Chengsong
parents:
diff changeset
   101
  \LARGE Formal Languages (1)\\[-3mm] 
Chengsong
parents:
diff changeset
   102
  \end{tabular}}
Chengsong
parents:
diff changeset
   103
Chengsong
parents:
diff changeset
   104
  \begin{center}
Chengsong
parents:
diff changeset
   105
  %\includegraphics[scale=0.3]{pics/ante1.jpg}\hspace{5mm}
Chengsong
parents:
diff changeset
   106
  %\includegraphics[scale=0.31]{pics/ante2.jpg}\\
Chengsong
parents:
diff changeset
   107
  %\footnotesize\textcolor{gray}{Antikythera automaton, 100 BC (Archimedes?)}
Chengsong
parents:
diff changeset
   108
  \end{center}
Chengsong
parents:
diff changeset
   109
Chengsong
parents:
diff changeset
   110
  \normalsize
Chengsong
parents:
diff changeset
   111
  \begin{center}
Chengsong
parents:
diff changeset
   112
  \begin{tabular}{ll}
Chengsong
parents:
diff changeset
   113
  Email:  & christian.urban at kcl.ac.uk\\
Chengsong
parents:
diff changeset
   114
  Office: & N\liningnums{7.07} (North Wing, Bush House)\\
Chengsong
parents:
diff changeset
   115
  Slides: & KEATS
Chengsong
parents:
diff changeset
   116
  \end{tabular}
Chengsong
parents:
diff changeset
   117
  \end{center}
Chengsong
parents:
diff changeset
   118
Chengsong
parents:
diff changeset
   119
\end{frame}
Chengsong
parents:
diff changeset
   120
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Chengsong
parents:
diff changeset
   121
Chengsong
parents:
diff changeset
   122
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Chengsong
parents:
diff changeset
   123
\begin{frame}[t]
Chengsong
parents:
diff changeset
   124
\frametitle{Why Study Compilers?}
Chengsong
parents:
diff changeset
   125
Chengsong
parents:
diff changeset
   126
John Regehr {\small(Univ.~Utah, LLVM compiler hacker)}\smallskip\\
Chengsong
parents:
diff changeset
   127
Chengsong
parents:
diff changeset
   128
\begin{bubble}[10.5cm]
Chengsong
parents:
diff changeset
   129
  \bf ``\ldots{}It’s effectively a perpetual
Chengsong
parents:
diff changeset
   130
  employment act for solid compiler hackers.''
Chengsong
parents:
diff changeset
   131
\end{bubble}
Chengsong
parents:
diff changeset
   132
Chengsong
parents:
diff changeset
   133
\onslide<1->{
Chengsong
parents:
diff changeset
   134
\only<2>{
Chengsong
parents:
diff changeset
   135
\begin{itemize}
Chengsong
parents:
diff changeset
   136
\item {\bf Hardware is getting weirder
Chengsong
parents:
diff changeset
   137
  rather than getting clocked faster}
Chengsong
parents:
diff changeset
   138
Chengsong
parents:
diff changeset
   139
\begin{itemize}
Chengsong
parents:
diff changeset
   140
\item  Almost all processors are
Chengsong
parents:
diff changeset
   141
  multicores nowadays and it looks like there is increasing asymmetry in
Chengsong
parents:
diff changeset
   142
  resources across cores. Processors come with vector units, crypto
Chengsong
parents:
diff changeset
   143
  accelerators etc. We have DSPs, GPUs,
Chengsong
parents:
diff changeset
   144
  ARM big.little, and Xeon Phi. This is only scratching the
Chengsong
parents:
diff changeset
   145
  surface.
Chengsong
parents:
diff changeset
   146
\end{itemize}  
Chengsong
parents:
diff changeset
   147
\end{itemize}}
Chengsong
parents:
diff changeset
   148
\only<3>{
Chengsong
parents:
diff changeset
   149
\begin{itemize}
Chengsong
parents:
diff changeset
   150
\item {\bf We’re getting tired of low-level languages and
Chengsong
parents:
diff changeset
   151
    their associated security disasters}
Chengsong
parents:
diff changeset
   152
  
Chengsong
parents:
diff changeset
   153
\begin{itemize}
Chengsong
parents:
diff changeset
   154
\item 
Chengsong
parents:
diff changeset
   155
  We want to write new code, to
Chengsong
parents:
diff changeset
   156
  whatever extent possible, in safer, higher-level
Chengsong
parents:
diff changeset
   157
  languages. Compilers are caught right in the middle of these
Chengsong
parents:
diff changeset
   158
  opposing trends: one of their main jobs is to help bridge the large
Chengsong
parents:
diff changeset
   159
  and growing gap between increasingly high-level languages and
Chengsong
parents:
diff changeset
   160
  increasingly wacky platforms.
Chengsong
parents:
diff changeset
   161
\end{itemize}  
Chengsong
parents:
diff changeset
   162
\end{itemize}}}
Chengsong
parents:
diff changeset
   163
Chengsong
parents:
diff changeset
   164
\end{frame}
Chengsong
parents:
diff changeset
   165
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Chengsong
parents:
diff changeset
   166
Chengsong
parents:
diff changeset
   167
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Chengsong
parents:
diff changeset
   168
\begin{frame}[c]
Chengsong
parents:
diff changeset
   169
\frametitle{Why Bother?}
Chengsong
parents:
diff changeset
   170
Chengsong
parents:
diff changeset
   171
\begin{columns}[t]
Chengsong
parents:
diff changeset
   172
\begin{column}{.5\textwidth}
Chengsong
parents:
diff changeset
   173
Ruby, Python, Java 8\medskip\\
Chengsong
parents:
diff changeset
   174
\begin{tikzpicture}\footnotesize
Chengsong
parents:
diff changeset
   175
\begin{axis}[
Chengsong
parents:
diff changeset
   176
    xlabel={$n$},
Chengsong
parents:
diff changeset
   177
    x label style={at={(1.05,0.0)}},
Chengsong
parents:
diff changeset
   178
    ylabel={time in secs},
Chengsong
parents:
diff changeset
   179
    enlargelimits=false,
Chengsong
parents:
diff changeset
   180
    xtick={0,5,...,30},
Chengsong
parents:
diff changeset
   181
    xmax=33,
Chengsong
parents:
diff changeset
   182
    ymax=35,
Chengsong
parents:
diff changeset
   183
    ytick={0,5,...,30},
Chengsong
parents:
diff changeset
   184
    scaled ticks=false,
Chengsong
parents:
diff changeset
   185
    axis lines=left,
Chengsong
parents:
diff changeset
   186
    width=5.5cm,
Chengsong
parents:
diff changeset
   187
    height=4cm, 
Chengsong
parents:
diff changeset
   188
    legend entries={Python,Ruby},  
Chengsong
parents:
diff changeset
   189
    legend pos=north west,
Chengsong
parents:
diff changeset
   190
    legend cell align=left]
Chengsong
parents:
diff changeset
   191
\addplot[blue,mark=*, mark options={fill=white}] table {re-python.data};
Chengsong
parents:
diff changeset
   192
\addplot[brown,mark=triangle*, mark options={fill=white}] table {re-ruby.data};
Chengsong
parents:
diff changeset
   193
\end{axis}
Chengsong
parents:
diff changeset
   194
\end{tikzpicture}
Chengsong
parents:
diff changeset
   195
\begin{tikzpicture}\footnotesize
Chengsong
parents:
diff changeset
   196
\begin{axis}[
Chengsong
parents:
diff changeset
   197
    xlabel={$n$},
Chengsong
parents:
diff changeset
   198
    x label style={at={(1.05,0.0)}},
Chengsong
parents:
diff changeset
   199
    ylabel={time in secs},
Chengsong
parents:
diff changeset
   200
    enlargelimits=false,
Chengsong
parents:
diff changeset
   201
    xtick={0,5,...,30},
Chengsong
parents:
diff changeset
   202
    xmax=33,
Chengsong
parents:
diff changeset
   203
    ymax=35,
Chengsong
parents:
diff changeset
   204
    ytick={0,5,...,30},
Chengsong
parents:
diff changeset
   205
    scaled ticks=false,
Chengsong
parents:
diff changeset
   206
    axis lines=left,
Chengsong
parents:
diff changeset
   207
    width=5.5cm,
Chengsong
parents:
diff changeset
   208
    height=4cm, 
Chengsong
parents:
diff changeset
   209
    legend entries={Python, Java 8},  
Chengsong
parents:
diff changeset
   210
    legend pos=north west,
Chengsong
parents:
diff changeset
   211
    legend cell align=left]
Chengsong
parents:
diff changeset
   212
\addplot[blue,mark=*, mark options={fill=white}] table {re-python2.data};   
Chengsong
parents:
diff changeset
   213
\addplot[cyan,mark=*, mark options={fill=white}] table {re-java.data};
Chengsong
parents:
diff changeset
   214
\end{axis}
Chengsong
parents:
diff changeset
   215
\end{tikzpicture}
Chengsong
parents:
diff changeset
   216
Chengsong
parents:
diff changeset
   217
\end{column}
Chengsong
parents:
diff changeset
   218
\begin{column}{.5\textwidth}
Chengsong
parents:
diff changeset
   219
Us (after next lecture)\medskip\\
Chengsong
parents:
diff changeset
   220
\begin{tikzpicture}\footnotesize
Chengsong
parents:
diff changeset
   221
\begin{axis}[
Chengsong
parents:
diff changeset
   222
    xlabel={$n$},
Chengsong
parents:
diff changeset
   223
    x label style={at={(1.07,0.0)}},
Chengsong
parents:
diff changeset
   224
    ylabel={time in secs},
Chengsong
parents:
diff changeset
   225
    enlargelimits=false,
Chengsong
parents:
diff changeset
   226
    xtick={0,5000,...,10000},
Chengsong
parents:
diff changeset
   227
    xmax=11000,
Chengsong
parents:
diff changeset
   228
    ymax=35,
Chengsong
parents:
diff changeset
   229
    ytick={0,5,...,30},
Chengsong
parents:
diff changeset
   230
    scaled ticks=false,
Chengsong
parents:
diff changeset
   231
    axis lines=left,
Chengsong
parents:
diff changeset
   232
    width=5.5cm,
Chengsong
parents:
diff changeset
   233
    height=4cm]
Chengsong
parents:
diff changeset
   234
\addplot[green,mark=square*,mark options={fill=white}] table {re2.data};
Chengsong
parents:
diff changeset
   235
\addplot[black,mark=square*,mark options={fill=white}] table {re3.data};
Chengsong
parents:
diff changeset
   236
\end{axis}
Chengsong
parents:
diff changeset
   237
\end{tikzpicture}
Chengsong
parents:
diff changeset
   238
\begin{tikzpicture}\footnotesize
Chengsong
parents:
diff changeset
   239
\begin{axis}[
Chengsong
parents:
diff changeset
   240
    xlabel={$n$},
Chengsong
parents:
diff changeset
   241
    x label style={at={(1.07,0.0)}},
Chengsong
parents:
diff changeset
   242
    ylabel={time in secs},
Chengsong
parents:
diff changeset
   243
    enlargelimits=false,
Chengsong
parents:
diff changeset
   244
    ymax=35,
Chengsong
parents:
diff changeset
   245
    ytick={0,5,...,30},
Chengsong
parents:
diff changeset
   246
    scaled ticks=false,
Chengsong
parents:
diff changeset
   247
    axis lines=left,
Chengsong
parents:
diff changeset
   248
    width=5.5cm,
Chengsong
parents:
diff changeset
   249
    height=4cm]
Chengsong
parents:
diff changeset
   250
\addplot[black,mark=square*,mark options={fill=white}] table {re3a.data};
Chengsong
parents:
diff changeset
   251
\end{axis}
Chengsong
parents:
diff changeset
   252
\end{tikzpicture}
Chengsong
parents:
diff changeset
   253
\end{column}
Chengsong
parents:
diff changeset
   254
\end{columns}\bigskip
Chengsong
parents:
diff changeset
   255
Chengsong
parents:
diff changeset
   256
\small\centering
Chengsong
parents:
diff changeset
   257
matching \texttt{[a?]\{n\}[a]\{n\}} and \texttt{(a*)*b}
Chengsong
parents:
diff changeset
   258
against $\underbrace{\texttt{a}...\texttt{a}}_n$
Chengsong
parents:
diff changeset
   259
\end{frame} 
Chengsong
parents:
diff changeset
   260
Chengsong
parents:
diff changeset
   261
\begin{frame}
Chengsong
parents:
diff changeset
   262
\begin{column}{.5\textwidth}
Chengsong
parents:
diff changeset
   263
\begin{tikzpicture}
Chengsong
parents:
diff changeset
   264
\begin{axis}[
Chengsong
parents:
diff changeset
   265
    xlabel={$n$},
Chengsong
parents:
diff changeset
   266
    x label style={at={(1.05,0.0)}},
Chengsong
parents:
diff changeset
   267
    ylabel={time in secs},
Chengsong
parents:
diff changeset
   268
    y label style={at={(0.06,0.5)}},
Chengsong
parents:
diff changeset
   269
    enlargelimits=false,
Chengsong
parents:
diff changeset
   270
    xtick={0,5,...,30},
Chengsong
parents:
diff changeset
   271
    xmax=33,
Chengsong
parents:
diff changeset
   272
    ymax=45,
Chengsong
parents:
diff changeset
   273
    ytick={0,10,...,40},
Chengsong
parents:
diff changeset
   274
    scaled ticks=false,
Chengsong
parents:
diff changeset
   275
    axis lines=left,
Chengsong
parents:
diff changeset
   276
    width=6cm,
Chengsong
parents:
diff changeset
   277
    height=4.5cm, 
Chengsong
parents:
diff changeset
   278
    legend entries={Python, Java 8},  
Chengsong
parents:
diff changeset
   279
    legend pos=north west]
Chengsong
parents:
diff changeset
   280
\addplot[blue,mark=*, mark options={fill=white}] table {re-python2.data};
Chengsong
parents:
diff changeset
   281
\addplot[cyan,mark=*, mark options={fill=white}] table {re-java.data};
Chengsong
parents:
diff changeset
   282
\end{axis}
Chengsong
parents:
diff changeset
   283
\end{tikzpicture}
Chengsong
parents:
diff changeset
   284
\begin{tikzpicture}
Chengsong
parents:
diff changeset
   285
\begin{axis}[
Chengsong
parents:
diff changeset
   286
    xlabel={$n$},
Chengsong
parents:
diff changeset
   287
    x label style={at={(1.05,0.0)}},
Chengsong
parents:
diff changeset
   288
    ylabel={time in secs},
Chengsong
parents:
diff changeset
   289
    y label style={at={(0.06,0.5)}},
Chengsong
parents:
diff changeset
   290
    %enlargelimits=false,
Chengsong
parents:
diff changeset
   291
    %xtick={0,5000,...,30000},
Chengsong
parents:
diff changeset
   292
    xmax=65000,
Chengsong
parents:
diff changeset
   293
    ymax=45,
Chengsong
parents:
diff changeset
   294
    ytick={0,10,...,40},
Chengsong
parents:
diff changeset
   295
    scaled ticks=false,
Chengsong
parents:
diff changeset
   296
    axis lines=left,
Chengsong
parents:
diff changeset
   297
    width=6cm,
Chengsong
parents:
diff changeset
   298
    height=4.5cm, 
Chengsong
parents:
diff changeset
   299
    legend entries={Java 9},  
Chengsong
parents:
diff changeset
   300
    legend pos=north west]
Chengsong
parents:
diff changeset
   301
\addplot[cyan,mark=*, mark options={fill=white}] table {re-java9.data};
Chengsong
parents:
diff changeset
   302
\end{axis}
Chengsong
parents:
diff changeset
   303
\end{tikzpicture}
Chengsong
parents:
diff changeset
   304
\end{column}
Chengsong
parents:
diff changeset
   305
\end{frame}
Chengsong
parents:
diff changeset
   306
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%  
Chengsong
parents:
diff changeset
   307
Chengsong
parents:
diff changeset
   308
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Chengsong
parents:
diff changeset
   309
\begin{frame}[c]
Chengsong
parents:
diff changeset
   310
\frametitle{Evil Regular Expressions}
Chengsong
parents:
diff changeset
   311
Chengsong
parents:
diff changeset
   312
\begin{itemize}
Chengsong
parents:
diff changeset
   313
\item \alert{R}egular \alert{e}xpression \alert{D}enial \alert{o}f \alert{S}ervice (ReDoS)\medskip
Chengsong
parents:
diff changeset
   314
\item Evil regular expressions\medskip
Chengsong
parents:
diff changeset
   315
\begin{itemize}
Chengsong
parents:
diff changeset
   316
\item \bl{$(a^{?\{n\}}) \cdot a^{\{n\}}$}
Chengsong
parents:
diff changeset
   317
\item \bl{$(a^*)^*\cdot b$}
Chengsong
parents:
diff changeset
   318
\item \bl{$([a$\,-\,$z]^+)^*$}
Chengsong
parents:
diff changeset
   319
\item \bl{$(a + a \cdot a)^*$}
Chengsong
parents:
diff changeset
   320
\item \bl{$(a + a^?)^*$}
Chengsong
parents:
diff changeset
   321
\end{itemize}
Chengsong
parents:
diff changeset
   322
Chengsong
parents:
diff changeset
   323
\item sometimes also called \alert{catastrophic backtracking}
Chengsong
parents:
diff changeset
   324
\item this is a problem for \alert{N}etwork \alert{I}ntrusion
Chengsong
parents:
diff changeset
   325
  \alert{D}etection systems, StackExchange, Atom editor
Chengsong
parents:
diff changeset
   326
\item \url{https://vimeo.com/112065252}  
Chengsong
parents:
diff changeset
   327
\end{itemize}
Chengsong
parents:
diff changeset
   328
Chengsong
parents:
diff changeset
   329
\end{frame}
Chengsong
parents:
diff changeset
   330
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Chengsong
parents:
diff changeset
   331
Chengsong
parents:
diff changeset
   332
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Chengsong
parents:
diff changeset
   333
\begin{frame}[c]
Chengsong
parents:
diff changeset
   334
\frametitle{The Goal of this Module}
Chengsong
parents:
diff changeset
   335
Chengsong
parents:
diff changeset
   336
\begin{center}
Chengsong
parents:
diff changeset
   337
  \begin{tikzpicture}[scale=1,
Chengsong
parents:
diff changeset
   338
                      node/.style={
Chengsong
parents:
diff changeset
   339
                      rectangle,rounded corners=3mm,
Chengsong
parents:
diff changeset
   340
                      very thick,draw=black!50,minimum height=18mm, minimum width=20mm,
Chengsong
parents:
diff changeset
   341
                      top color=white,bottom color=black!20}]
Chengsong
parents:
diff changeset
   342
Chengsong
parents:
diff changeset
   343
  \node at (3.05, 1.8) {\Large\bf write a compiler};
Chengsong
parents:
diff changeset
   344
Chengsong
parents:
diff changeset
   345
  \node (0) at (-2.3,0) {};  
Chengsong
parents:
diff changeset
   346
  \node [above=5mm of 0]
Chengsong
parents:
diff changeset
   347
  {\makebox[0mm]{\footnotesize
Chengsong
parents:
diff changeset
   348
      \begin{tabular}{@{}l@{}}input\\[-1mm]program\end{tabular}}}; 
Chengsong
parents:
diff changeset
   349
     
Chengsong
parents:
diff changeset
   350
  \node (A) at (0,0)  [node] {};
Chengsong
parents:
diff changeset
   351
  \node [below right] at (A.north west) {lexer};
Chengsong
parents:
diff changeset
   352
Chengsong
parents:
diff changeset
   353
  \node (B) at (3,0)  [node] {};
Chengsong
parents:
diff changeset
   354
  \node [below right=1mm] at (B.north west) {\mbox{}\hspace{-1mm}parser};
Chengsong
parents:
diff changeset
   355
Chengsong
parents:
diff changeset
   356
  \node (C) at (6,0)  [node] {};
Chengsong
parents:
diff changeset
   357
  \node [below right] at (C.north west) {\mbox{}\hspace{-1mm}code gen};
Chengsong
parents:
diff changeset
   358
Chengsong
parents:
diff changeset
   359
  \node (1) at (8.4,0) {};
Chengsong
parents:
diff changeset
   360
  \node [above=5mm of 1]
Chengsong
parents:
diff changeset
   361
  {\makebox[0mm]{\footnotesize
Chengsong
parents:
diff changeset
   362
      \begin{tabular}{@{}r@{}}binary\\[-1mm]code\end{tabular}}};
Chengsong
parents:
diff changeset
   363
Chengsong
parents:
diff changeset
   364
  \draw [->,line width=4mm] (0) -- (A); 
Chengsong
parents:
diff changeset
   365
  \draw [->,line width=4mm] (A) -- (B); 
Chengsong
parents:
diff changeset
   366
  \draw [->,line width=4mm] (B) -- (C); 
Chengsong
parents:
diff changeset
   367
  \draw [->,line width=4mm] (C) -- (1); 
Chengsong
parents:
diff changeset
   368
  \end{tikzpicture}
Chengsong
parents:
diff changeset
   369
  \end{center}
Chengsong
parents:
diff changeset
   370
Chengsong
parents:
diff changeset
   371
\only<2,3,4>{
Chengsong
parents:
diff changeset
   372
\begin{textblock}{1}(1,2.1)
Chengsong
parents:
diff changeset
   373
\begin{bubble}[9.8cm]
Chengsong
parents:
diff changeset
   374
\normalsize
Chengsong
parents:
diff changeset
   375
lexer input: a string\smallskip\\
Chengsong
parents:
diff changeset
   376
\hspace{5mm}\code{"read(n);"}\medskip\\
Chengsong
parents:
diff changeset
   377
lexer output: a sequence of tokens\smallskip\\
Chengsong
parents:
diff changeset
   378
\hspace{5mm}\code{key(read) lpar id(n) rpar semi}
Chengsong
parents:
diff changeset
   379
\end{bubble}
Chengsong
parents:
diff changeset
   380
\end{textblock}}
Chengsong
parents:
diff changeset
   381
Chengsong
parents:
diff changeset
   382
\only<3,4>{
Chengsong
parents:
diff changeset
   383
\begin{textblock}{1}(6,7.8)
Chengsong
parents:
diff changeset
   384
\begin{tabular}{c}
Chengsong
parents:
diff changeset
   385
\includegraphics[scale=0.2]{rosetta.jpg}\\[-2mm]
Chengsong
parents:
diff changeset
   386
\footnotesize lexing $\Rightarrow$ recognising words (Stone of Rosetta)
Chengsong
parents:
diff changeset
   387
\end{tabular}
Chengsong
parents:
diff changeset
   388
\end{textblock}}
Chengsong
parents:
diff changeset
   389
Chengsong
parents:
diff changeset
   390
\only<4>{
Chengsong
parents:
diff changeset
   391
\begin{textblock}{1}(0.5,12)\small
Chengsong
parents:
diff changeset
   392
\begin{tabular}{l@{}c@{}l}
Chengsong
parents:
diff changeset
   393
  \pcode{if}    & $\;\Rightarrow\;$ & keyword\\
Chengsong
parents:
diff changeset
   394
  \pcode{iffoo} & $\;\Rightarrow\;$ & identifier\\
Chengsong
parents:
diff changeset
   395
\end{tabular}  
Chengsong
parents:
diff changeset
   396
\end{textblock}}
Chengsong
parents:
diff changeset
   397
Chengsong
parents:
diff changeset
   398
\only<5>{
Chengsong
parents:
diff changeset
   399
\begin{textblock}{1}(1,1.5)
Chengsong
parents:
diff changeset
   400
\begin{bubble}[8.5cm]
Chengsong
parents:
diff changeset
   401
\normalsize
Chengsong
parents:
diff changeset
   402
parser input: a sequence of tokens\smallskip\\
Chengsong
parents:
diff changeset
   403
Chengsong
parents:
diff changeset
   404
{\small\hspace{5mm}\code{key(read) lpar id(n) rpar semi}}\smallskip\\
Chengsong
parents:
diff changeset
   405
Chengsong
parents:
diff changeset
   406
parser output: an abstract syntax tree\smallskip\\
Chengsong
parents:
diff changeset
   407
\footnotesize
Chengsong
parents:
diff changeset
   408
\hspace{2cm}\begin{tikzpicture}
Chengsong
parents:
diff changeset
   409
  \node {\code{read}}
Chengsong
parents:
diff changeset
   410
    child {node {\code{lpar}}}
Chengsong
parents:
diff changeset
   411
    child {node {\code{n}}}
Chengsong
parents:
diff changeset
   412
    child {node {\code{rpar}}};
Chengsong
parents:
diff changeset
   413
\end{tikzpicture}
Chengsong
parents:
diff changeset
   414
\end{bubble}
Chengsong
parents:
diff changeset
   415
\end{textblock}}
Chengsong
parents:
diff changeset
   416
Chengsong
parents:
diff changeset
   417
\only<6,7>{
Chengsong
parents:
diff changeset
   418
\begin{textblock}{1}(1,1.5)
Chengsong
parents:
diff changeset
   419
\begin{bubble}[4cm]
Chengsong
parents:
diff changeset
   420
\normalsize
Chengsong
parents:
diff changeset
   421
code generator:\smallskip\\
Chengsong
parents:
diff changeset
   422
\hspace{5mm}\code{istore 2}\\ 
Chengsong
parents:
diff changeset
   423
\hspace{5mm}\code{iload 2}\\ 
Chengsong
parents:
diff changeset
   424
\hspace{5mm}\code{ldc 10}\\
Chengsong
parents:
diff changeset
   425
\hspace{5mm}\code{isub}\\
Chengsong
parents:
diff changeset
   426
\hspace{5mm}\code{ifeq Label2}\\ 
Chengsong
parents:
diff changeset
   427
\hspace{5mm}\code{iload 2}\\
Chengsong
parents:
diff changeset
   428
\hspace{5mm}\code{...}\\
Chengsong
parents:
diff changeset
   429
\end{bubble}
Chengsong
parents:
diff changeset
   430
\end{textblock}}
Chengsong
parents:
diff changeset
   431
Chengsong
parents:
diff changeset
   432
\only<7>{
Chengsong
parents:
diff changeset
   433
\begin{textblock}{6}(8.4,7)
Chengsong
parents:
diff changeset
   434
\begin{bubble}[5cm]
Chengsong
parents:
diff changeset
   435
\mbox{\begin{tikzpicture}[scale=0.58,rounded corners=0mm]
Chengsong
parents:
diff changeset
   436
\begin{axis}[axis x line=bottom, axis y line=left, ylabel=secs,
Chengsong
parents:
diff changeset
   437
    xlabel=n,
Chengsong
parents:
diff changeset
   438
    enlargelimits=0.05,
Chengsong
parents:
diff changeset
   439
    ybar interval=0.7, legend style=small]
Chengsong
parents:
diff changeset
   440
\addplot file {interpreted2.data};
Chengsong
parents:
diff changeset
   441
\addplot file {compiled2.data};
Chengsong
parents:
diff changeset
   442
%\legend{interpreted, compiled}
Chengsong
parents:
diff changeset
   443
\end{axis}
Chengsong
parents:
diff changeset
   444
\end{tikzpicture}}
Chengsong
parents:
diff changeset
   445
\end{bubble}
Chengsong
parents:
diff changeset
   446
\end{textblock}}
Chengsong
parents:
diff changeset
   447
Chengsong
parents:
diff changeset
   448
\end{frame}
Chengsong
parents:
diff changeset
   449
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%     
Chengsong
parents:
diff changeset
   450
Chengsong
parents:
diff changeset
   451
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Chengsong
parents:
diff changeset
   452
\begin{frame}[c]
Chengsong
parents:
diff changeset
   453
\frametitle{The Acad.~Subject is Mature}
Chengsong
parents:
diff changeset
   454
Chengsong
parents:
diff changeset
   455
\begin{itemize}
Chengsong
parents:
diff changeset
   456
\item Turing Machines, 1936
Chengsong
parents:
diff changeset
   457
\item Regular Expressions, 1956\\
Chengsong
parents:
diff changeset
   458
\item The first compiler for COBOL, 1957\\ (Grace Hopper)
Chengsong
parents:
diff changeset
   459
\item But surprisingly research papers are still published nowadays\\
Chengsong
parents:
diff changeset
   460
\item ``Parsing: The Solved Problem That Isn't''
Chengsong
parents:
diff changeset
   461
\end{itemize}
Chengsong
parents:
diff changeset
   462
Chengsong
parents:
diff changeset
   463
\begin{flushright}
Chengsong
parents:
diff changeset
   464
\includegraphics[scale=0.3]{hopper.jpg}\\
Chengsong
parents:
diff changeset
   465
\footnotesize\textcolor{gray}{Grace Hopper}
Chengsong
parents:
diff changeset
   466
\end{flushright}
Chengsong
parents:
diff changeset
   467
Chengsong
parents:
diff changeset
   468
Chengsong
parents:
diff changeset
   469
\begin{flushright}
Chengsong
parents:
diff changeset
   470
\mbox{}\\[-6mm]
Chengsong
parents:
diff changeset
   471
{\footnotesize\textcolor{gray}{(she made it to David Letterman's Tonight Show,\\[-2mm]
Chengsong
parents:
diff changeset
   472
 \url{http://www.youtube.com/watch?v=aZOxtURhfEU})}}
Chengsong
parents:
diff changeset
   473
\end{flushright}
Chengsong
parents:
diff changeset
   474
Chengsong
parents:
diff changeset
   475
\end{frame}
Chengsong
parents:
diff changeset
   476
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%     
Chengsong
parents:
diff changeset
   477
Chengsong
parents:
diff changeset
   478
Chengsong
parents:
diff changeset
   479
Chengsong
parents:
diff changeset
   480
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Chengsong
parents:
diff changeset
   481
\begin{frame}[c]
Chengsong
parents:
diff changeset
   482
\frametitle{Lectures 1 - 5}
Chengsong
parents:
diff changeset
   483
Chengsong
parents:
diff changeset
   484
transforming strings into structured data\\[10mm]
Chengsong
parents:
diff changeset
   485
Chengsong
parents:
diff changeset
   486
{\LARGE\bf Lexing} {\hfill{}based on regular expressions}\medskip\\
Chengsong
parents:
diff changeset
   487
\hspace{5mm}(recognising ``words'')\\[6mm]
Chengsong
parents:
diff changeset
   488
Chengsong
parents:
diff changeset
   489
{\LARGE\bf Parsing}\medskip\\
Chengsong
parents:
diff changeset
   490
\hspace{5mm}(recognising ``sentences'')
Chengsong
parents:
diff changeset
   491
Chengsong
parents:
diff changeset
   492
\begin{textblock}{1}(10,9.1)
Chengsong
parents:
diff changeset
   493
\begin{tabular}{c}
Chengsong
parents:
diff changeset
   494
\includegraphics[scale=0.1]{rosetta.jpg}\\[-2mm]
Chengsong
parents:
diff changeset
   495
\footnotesize Stone of Rosetta
Chengsong
parents:
diff changeset
   496
\end{tabular}
Chengsong
parents:
diff changeset
   497
\end{textblock}
Chengsong
parents:
diff changeset
   498
Chengsong
parents:
diff changeset
   499
\end{frame}
Chengsong
parents:
diff changeset
   500
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
Chengsong
parents:
diff changeset
   501
Chengsong
parents:
diff changeset
   502
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Chengsong
parents:
diff changeset
   503
\begin{frame}[t]
Chengsong
parents:
diff changeset
   504
\frametitle{Familiar Regular Expr.}
Chengsong
parents:
diff changeset
   505
\small
Chengsong
parents:
diff changeset
   506
\begin{center}
Chengsong
parents:
diff changeset
   507
\texttt{[a-z0-9\_$\backslash{}$.-]+ @ [a-z0-9$\backslash{}$.-]+ . [a-z$\backslash{}$.]\{2,6\}}
Chengsong
parents:
diff changeset
   508
\end{center}\smallskip
Chengsong
parents:
diff changeset
   509
Chengsong
parents:
diff changeset
   510
\begin{center}
Chengsong
parents:
diff changeset
   511
\begin{tabular}{@{}lp{8.5cm}@{}}
Chengsong
parents:
diff changeset
   512
\pcode{re*} & matches 0 or more times\\
Chengsong
parents:
diff changeset
   513
\pcode{re+} & matches 1 or more times\\
Chengsong
parents:
diff changeset
   514
\pcode{re?} & matches 0 or 1 times\\
Chengsong
parents:
diff changeset
   515
\pcode{re\{n\}}	& matches exactly \pcode{n} number of times\\
Chengsong
parents:
diff changeset
   516
\pcode{re\{n,m\}} & matches at least \pcode{n} and at most {\tt m} times\\
Chengsong
parents:
diff changeset
   517
\pcode{[...]} & matches any single character inside the brackets\\
Chengsong
parents:
diff changeset
   518
\pcode{[^...]} & matches any single character not inside the 
Chengsong
parents:
diff changeset
   519
brackets\\
Chengsong
parents:
diff changeset
   520
\pcode{a-z A-Z} & character ranges\\
Chengsong
parents:
diff changeset
   521
\pcode{\\d} & matches digits; equivalent to \pcode{[0-9]}\\
Chengsong
parents:
diff changeset
   522
\pcode{.} & matches every character except newline\\
Chengsong
parents:
diff changeset
   523
\pcode{(re)}	& groups regular expressions and remembers 
Chengsong
parents:
diff changeset
   524
the matched text
Chengsong
parents:
diff changeset
   525
\end{tabular}
Chengsong
parents:
diff changeset
   526
\end{center}
Chengsong
parents:
diff changeset
   527
Chengsong
parents:
diff changeset
   528
Chengsong
parents:
diff changeset
   529
\end{frame}
Chengsong
parents:
diff changeset
   530
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
Chengsong
parents:
diff changeset
   531
Chengsong
parents:
diff changeset
   532
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Chengsong
parents:
diff changeset
   533
\begin{frame}[c]
Chengsong
parents:
diff changeset
   534
\frametitle{Today}
Chengsong
parents:
diff changeset
   535
Chengsong
parents:
diff changeset
   536
\begin{itemize}
Chengsong
parents:
diff changeset
   537
\item While the ultimate goal is to implement a small compiler for the JVM
Chengsong
parents:
diff changeset
   538
  \ldots\bigskip
Chengsong
parents:
diff changeset
   539
\end{itemize}
Chengsong
parents:
diff changeset
   540
Chengsong
parents:
diff changeset
   541
Let's start with:
Chengsong
parents:
diff changeset
   542
Chengsong
parents:
diff changeset
   543
\begin{itemize}
Chengsong
parents:
diff changeset
   544
\item a web-crawler
Chengsong
parents:
diff changeset
   545
\item an email harvester
Chengsong
parents:
diff changeset
   546
%\item \textcolor{gray}{(a web-scraper)}
Chengsong
parents:
diff changeset
   547
\end{itemize}
Chengsong
parents:
diff changeset
   548
Chengsong
parents:
diff changeset
   549
\end{frame}
Chengsong
parents:
diff changeset
   550
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%  
Chengsong
parents:
diff changeset
   551
Chengsong
parents:
diff changeset
   552
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Chengsong
parents:
diff changeset
   553
\begin{frame}[t]
Chengsong
parents:
diff changeset
   554
\frametitle{A Web-Crawler}
Chengsong
parents:
diff changeset
   555
Chengsong
parents:
diff changeset
   556
\mbox{}\\[10mm]
Chengsong
parents:
diff changeset
   557
Chengsong
parents:
diff changeset
   558
\begin{enumerate}
Chengsong
parents:
diff changeset
   559
\item given an URL, read the corresponding webpage
Chengsong
parents:
diff changeset
   560
\item extract all links from it
Chengsong
parents:
diff changeset
   561
\item call the web-crawler again for all these links
Chengsong
parents:
diff changeset
   562
\end{enumerate}
Chengsong
parents:
diff changeset
   563
Chengsong
parents:
diff changeset
   564
\end{frame}
Chengsong
parents:
diff changeset
   565
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
Chengsong
parents:
diff changeset
   566
Chengsong
parents:
diff changeset
   567
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Chengsong
parents:
diff changeset
   568
\begin{frame}[t]
Chengsong
parents:
diff changeset
   569
\frametitle{A Web-Crawler}
Chengsong
parents:
diff changeset
   570
Chengsong
parents:
diff changeset
   571
\mbox{}\\[10mm]
Chengsong
parents:
diff changeset
   572
Chengsong
parents:
diff changeset
   573
Chengsong
parents:
diff changeset
   574
\begin{enumerate}
Chengsong
parents:
diff changeset
   575
\item given an URL, read the corresponding webpage
Chengsong
parents:
diff changeset
   576
\item if not possible print, out a problem
Chengsong
parents:
diff changeset
   577
\item if possible, extract all links from it
Chengsong
parents:
diff changeset
   578
\item call the web-crawler again for all these links
Chengsong
parents:
diff changeset
   579
\end{enumerate}\bigskip\pause
Chengsong
parents:
diff changeset
   580
Chengsong
parents:
diff changeset
   581
\small (we need a bound for the number of recursive calls)
Chengsong
parents:
diff changeset
   582
Chengsong
parents:
diff changeset
   583
\small (the purpose is to check all links on my own webpage)
Chengsong
parents:
diff changeset
   584
\end{frame}
Chengsong
parents:
diff changeset
   585
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
Chengsong
parents:
diff changeset
   586
Chengsong
parents:
diff changeset
   587
Chengsong
parents:
diff changeset
   588
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Chengsong
parents:
diff changeset
   589
\begin{frame}[c]
Chengsong
parents:
diff changeset
   590
Chengsong
parents:
diff changeset
   591
\begin{textblock}{1}(2,5)
Chengsong
parents:
diff changeset
   592
\begin{tabular}{c}
Chengsong
parents:
diff changeset
   593
\includegraphics[scale=0.15]{servers.png}\\[-2mm]
Chengsong
parents:
diff changeset
   594
\small Server
Chengsong
parents:
diff changeset
   595
\end{tabular}
Chengsong
parents:
diff changeset
   596
\end{textblock}
Chengsong
parents:
diff changeset
   597
Chengsong
parents:
diff changeset
   598
\begin{textblock}{1}(5.6,4)
Chengsong
parents:
diff changeset
   599
  \begin{tikzpicture}[scale=1.1]
Chengsong
parents:
diff changeset
   600
  \draw[white] (0,1) node (X) {};
Chengsong
parents:
diff changeset
   601
  \draw[white] (2,1) node (Y) {};
Chengsong
parents:
diff changeset
   602
   \draw[white] (0,0) node (X1) {};
Chengsong
parents:
diff changeset
   603
  \draw[white] (2,0) node (Y1) {};
Chengsong
parents:
diff changeset
   604
   \draw[white] (0,-1) node (X2) {};
Chengsong
parents:
diff changeset
   605
  \draw[white] (2,-1) node (Y2) {};
Chengsong
parents:
diff changeset
   606
  \draw[red, <-, line width = 2mm] (X) -- (Y);
Chengsong
parents:
diff changeset
   607
  \node [inner sep=5pt,label=above:\textcolor{black}{GET request}] at ($ (X)!.5!(Y) $) {};
Chengsong
parents:
diff changeset
   608
  \draw[red, ->, line width = 2mm] (X1) -- (Y1);
Chengsong
parents:
diff changeset
   609
  \node [inner sep=5pt,label=above:\textcolor{black}{webpage}] at ($ (X1)!.5!(Y1) $) {};
Chengsong
parents:
diff changeset
   610
  \draw[red, <-, line width = 2mm] (X2) -- (Y2);
Chengsong
parents:
diff changeset
   611
  \node [inner sep=7pt,label=above:\textcolor{black}{POST data}] at ($ (X2)!.5!(Y2) $) {};
Chengsong
parents:
diff changeset
   612
  \end{tikzpicture}
Chengsong
parents:
diff changeset
   613
\end{textblock}
Chengsong
parents:
diff changeset
   614
Chengsong
parents:
diff changeset
   615
Chengsong
parents:
diff changeset
   616
\begin{textblock}{1}(9,5.5)
Chengsong
parents:
diff changeset
   617
\begin{tabular}{c}
Chengsong
parents:
diff changeset
   618
\includegraphics[scale=0.15]{laptop.png}\\[-2mm]
Chengsong
parents:
diff changeset
   619
\small Browser
Chengsong
parents:
diff changeset
   620
\end{tabular}
Chengsong
parents:
diff changeset
   621
\end{textblock}
Chengsong
parents:
diff changeset
   622
\end{frame}
Chengsong
parents:
diff changeset
   623
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
Chengsong
parents:
diff changeset
   624
Chengsong
parents:
diff changeset
   625
  
Chengsong
parents:
diff changeset
   626
Chengsong
parents:
diff changeset
   627
 
Chengsong
parents:
diff changeset
   628
Chengsong
parents:
diff changeset
   629
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Chengsong
parents:
diff changeset
   630
\begin{frame}[t]
Chengsong
parents:
diff changeset
   631
\frametitle{A Regular Expression}
Chengsong
parents:
diff changeset
   632
Chengsong
parents:
diff changeset
   633
\begin{itemize}
Chengsong
parents:
diff changeset
   634
\item \ldots{} is a pattern or template for specifying strings
Chengsong
parents:
diff changeset
   635
\end{itemize}\bigskip
Chengsong
parents:
diff changeset
   636
  
Chengsong
parents:
diff changeset
   637
\begin{center}  
Chengsong
parents:
diff changeset
   638
\only<1>{\scode{"https?://[^"]*"}}%
Chengsong
parents:
diff changeset
   639
\only<2>{\scode{""""https?://[^"]*"""".r}}
Chengsong
parents:
diff changeset
   640
\end{center}\bigskip\bigskip
Chengsong
parents:
diff changeset
   641
Chengsong
parents:
diff changeset
   642
matches for example\smallskip\\  
Chengsong
parents:
diff changeset
   643
\hspace{2mm}\code{"http://www.foobar.com"}\\
Chengsong
parents:
diff changeset
   644
\hspace{2mm}\code{"https://www.tls.org"}\smallskip\\
Chengsong
parents:
diff changeset
   645
Chengsong
parents:
diff changeset
   646
but not\smallskip\\  
Chengsong
parents:
diff changeset
   647
\hspace{2mm}\code{"http://www."foo"bar.com"}\\
Chengsong
parents:
diff changeset
   648
Chengsong
parents:
diff changeset
   649
\end{frame}
Chengsong
parents:
diff changeset
   650
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
Chengsong
parents:
diff changeset
   651
Chengsong
parents:
diff changeset
   652
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Chengsong
parents:
diff changeset
   653
\begin{frame}[c]
Chengsong
parents:
diff changeset
   654
\frametitle{Finding Operations in Scala}
Chengsong
parents:
diff changeset
   655
Chengsong
parents:
diff changeset
   656
{\bf\code{rexp.findAllIn(string)}}\medskip
Chengsong
parents:
diff changeset
   657
  
Chengsong
parents:
diff changeset
   658
returns a list of all (sub)strings that match the 
Chengsong
parents:
diff changeset
   659
regular expression
Chengsong
parents:
diff changeset
   660
\bigskip\bigskip  
Chengsong
parents:
diff changeset
   661
  
Chengsong
parents:
diff changeset
   662
Chengsong
parents:
diff changeset
   663
{\bf\code{rexp.findFirstIn(string)}}\medskip
Chengsong
parents:
diff changeset
   664
 
Chengsong
parents:
diff changeset
   665
returns either 
Chengsong
parents:
diff changeset
   666
Chengsong
parents:
diff changeset
   667
\begin{itemize}
Chengsong
parents:
diff changeset
   668
\item \code{None} if no (sub)string matches or 
Chengsong
parents:
diff changeset
   669
\item \code{Some(s)} with the first (sub)string
Chengsong
parents:
diff changeset
   670
\end{itemize}
Chengsong
parents:
diff changeset
   671
Chengsong
parents:
diff changeset
   672
\end{frame}
Chengsong
parents:
diff changeset
   673
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
Chengsong
parents:
diff changeset
   674
Chengsong
parents:
diff changeset
   675
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Chengsong
parents:
diff changeset
   676
\begin{frame}[t]
Chengsong
parents:
diff changeset
   677
\frametitle{Regular Expressions}
Chengsong
parents:
diff changeset
   678
Chengsong
parents:
diff changeset
   679
Their inductive definition:
Chengsong
parents:
diff changeset
   680
Chengsong
parents:
diff changeset
   681
Chengsong
parents:
diff changeset
   682
\begin{textblock}{6}(2,7.5)
Chengsong
parents:
diff changeset
   683
  \begin{tabular}{@ {}rrl@ {\hspace{13mm}}l}
Chengsong
parents:
diff changeset
   684
  \bl{$r$} & \bl{$::=$}  & \bl{$\ZERO$}  & nothing\\
Chengsong
parents:
diff changeset
   685
         & \bl{$\mid$} & \bl{$\ONE$}       & empty string / \pcode{""} / $[]$\\
Chengsong
parents:
diff changeset
   686
         & \bl{$\mid$} & \bl{$c$}                         & character\\
Chengsong
parents:
diff changeset
   687
         & \bl{$\mid$} & \bl{$r_1 + r_2$}  & alternative / choice\\
Chengsong
parents:
diff changeset
   688
         & \bl{$\mid$} & \bl{$r_1 \cdot r_2$} & sequence\\
Chengsong
parents:
diff changeset
   689
         & \bl{$\mid$} & \bl{$r^*$}            & star (zero or more)\\
Chengsong
parents:
diff changeset
   690
  \end{tabular}
Chengsong
parents:
diff changeset
   691
  \end{textblock}
Chengsong
parents:
diff changeset
   692
  
Chengsong
parents:
diff changeset
   693
  
Chengsong
parents:
diff changeset
   694
  
Chengsong
parents:
diff changeset
   695
\end{frame}
Chengsong
parents:
diff changeset
   696
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
Chengsong
parents:
diff changeset
   697
Chengsong
parents:
diff changeset
   698
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Chengsong
parents:
diff changeset
   699
%\begin{frame}[t]
Chengsong
parents:
diff changeset
   700
%\frametitle{Regular Expressions}
Chengsong
parents:
diff changeset
   701
%
Chengsong
parents:
diff changeset
   702
%\small
Chengsong
parents:
diff changeset
   703
%In Scala:\bigskip
Chengsong
parents:
diff changeset
   704
%
Chengsong
parents:
diff changeset
   705
%\footnotesize
Chengsong
parents:
diff changeset
   706
%\lstinputlisting{../progs/app51.scala}
Chengsong
parents:
diff changeset
   707
%
Chengsong
parents:
diff changeset
   708
%  
Chengsong
parents:
diff changeset
   709
%\end{frame}
Chengsong
parents:
diff changeset
   710
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
Chengsong
parents:
diff changeset
   711
Chengsong
parents:
diff changeset
   712
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Chengsong
parents:
diff changeset
   713
\begin{frame}[t]
Chengsong
parents:
diff changeset
   714
\frametitle{Strings}
Chengsong
parents:
diff changeset
   715
Chengsong
parents:
diff changeset
   716
\ldots are lists of characters. For example \code{"hello"}
Chengsong
parents:
diff changeset
   717
Chengsong
parents:
diff changeset
   718
\begin{center}
Chengsong
parents:
diff changeset
   719
\bl{$[h, e, l, l, o]$} or just \bl{$hello$}
Chengsong
parents:
diff changeset
   720
\end{center}
Chengsong
parents:
diff changeset
   721
Chengsong
parents:
diff changeset
   722
the empty string: \bl{$[]$} or \bl{\pcode{""}}\bigskip\\
Chengsong
parents:
diff changeset
   723
Chengsong
parents:
diff changeset
   724
the concatenation of two strings:
Chengsong
parents:
diff changeset
   725
Chengsong
parents:
diff changeset
   726
\begin{center}
Chengsong
parents:
diff changeset
   727
\bl{$s_1 \,@\, s_2$}
Chengsong
parents:
diff changeset
   728
\end{center}
Chengsong
parents:
diff changeset
   729
Chengsong
parents:
diff changeset
   730
\bl{\textit{foo $@$ bar = foobar}, \textit{baz $@\, []$ = baz}}
Chengsong
parents:
diff changeset
   731
  
Chengsong
parents:
diff changeset
   732
\end{frame}
Chengsong
parents:
diff changeset
   733
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
Chengsong
parents:
diff changeset
   734
Chengsong
parents:
diff changeset
   735
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Chengsong
parents:
diff changeset
   736
\begin{frame}[c]
Chengsong
parents:
diff changeset
   737
\frametitle{Languages, Strings}
Chengsong
parents:
diff changeset
   738
Chengsong
parents:
diff changeset
   739
\begin{itemize}
Chengsong
parents:
diff changeset
   740
\item \alert{\bf Strings} are lists of characters, for example
Chengsong
parents:
diff changeset
   741
\begin{center}
Chengsong
parents:
diff changeset
   742
\bl{$[]$},\;\bl{$abc$}  \hspace{2cm}(Pattern match: \bl{$c\!::\!s$})
Chengsong
parents:
diff changeset
   743
\end{center}\bigskip
Chengsong
parents:
diff changeset
   744
Chengsong
parents:
diff changeset
   745
Chengsong
parents:
diff changeset
   746
\item A \alert{\bf language} is a set of strings, for example\medskip
Chengsong
parents:
diff changeset
   747
\begin{center}
Chengsong
parents:
diff changeset
   748
\bl{$\{[], hello, \textit{foobar}, a, abc\}$}
Chengsong
parents:
diff changeset
   749
\end{center}\bigskip
Chengsong
parents:
diff changeset
   750
Chengsong
parents:
diff changeset
   751
\item \alert{\bf Concatenation} of strings and languages
Chengsong
parents:
diff changeset
   752
Chengsong
parents:
diff changeset
   753
\begin{center}
Chengsong
parents:
diff changeset
   754
\begin{tabular}{rcl}
Chengsong
parents:
diff changeset
   755
\bl{$\textit{foo}\;@\;bar$} & \bl{$=$} & \bl{$\textit{foobar}$}\medskip\\
Chengsong
parents:
diff changeset
   756
\bl{$A\;@\;B$} & \bl{$\dn$} & \bl{$\{ s_1\,@\,s_2 \;\mid\; s_1 \in A \wedge s_2 \in B\}$}
Chengsong
parents:
diff changeset
   757
\end{tabular}
Chengsong
parents:
diff changeset
   758
\end{center}
Chengsong
parents:
diff changeset
   759
Chengsong
parents:
diff changeset
   760
%\item The \alert{\bf meaning} of a regular expression is a set of 
Chengsong
parents:
diff changeset
   761
%  strings, or language.
Chengsong
parents:
diff changeset
   762
\end{itemize}  
Chengsong
parents:
diff changeset
   763
Chengsong
parents:
diff changeset
   764
\end{frame}
Chengsong
parents:
diff changeset
   765
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
Chengsong
parents:
diff changeset
   766
Chengsong
parents:
diff changeset
   767
Chengsong
parents:
diff changeset
   768
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Chengsong
parents:
diff changeset
   769
\mode<presentation>{
Chengsong
parents:
diff changeset
   770
\begin{frame}[c]
Chengsong
parents:
diff changeset
   771
\frametitle{\begin{tabular}{c}The Meaning of a\\[-2mm] 
Chengsong
parents:
diff changeset
   772
  Regular Expression\end{tabular}}
Chengsong
parents:
diff changeset
   773
Chengsong
parents:
diff changeset
   774
\begin{textblock}{15}(1,4)
Chengsong
parents:
diff changeset
   775
 \begin{tabular}{rcl}
Chengsong
parents:
diff changeset
   776
 \bl{$L(\ZERO)$}  & \bl{$\dn$} & \bl{$\{\}$}\\
Chengsong
parents:
diff changeset
   777
 \bl{$L(\ONE)$}     & \bl{$\dn$} & \bl{$\{[]\}$}\\
Chengsong
parents:
diff changeset
   778
 \bl{$L(c)$}            & \bl{$\dn$} & \bl{$\{[c]\}$}\\
Chengsong
parents:
diff changeset
   779
 \bl{$L(r_1 + r_2)$}    & \bl{$\dn$} & \bl{$L(r_1) \cup L(r_2)$}\\
Chengsong
parents:
diff changeset
   780
 \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) \}$}\\
Chengsong
parents:
diff changeset
   781
 \bl{$L(r^*)$}           & \bl{$\dn$} & \onslide<4->{\bl{$\bigcup_{0 \le n} L(r)^n$}}\\
Chengsong
parents:
diff changeset
   782
  \end{tabular}\bigskip
Chengsong
parents:
diff changeset
   783
  
Chengsong
parents:
diff changeset
   784
\onslide<2->{
Chengsong
parents:
diff changeset
   785
\hspace{5mm}\bl{$L(r)^0 \;\dn\; \{[]\}$}\\
Chengsong
parents:
diff changeset
   786
\bl{$L(r)^{n+1} \;\dn\; L(r) \,@\, L(r)^n$}\hspace{9mm}\onslide<3->{\small\textcolor{gray}{(append on sets)}\\
Chengsong
parents:
diff changeset
   787
\small\hspace{5cm}\textcolor{gray}{$\{ s_1 @ s_2 \;|\; s_1\in L(r) \wedge s_2 \in L(r)^n \}$}}
Chengsong
parents:
diff changeset
   788
}  
Chengsong
parents:
diff changeset
   789
    \end{textblock}
Chengsong
parents:
diff changeset
   790
Chengsong
parents:
diff changeset
   791
\end{frame}}
Chengsong
parents:
diff changeset
   792
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
Chengsong
parents:
diff changeset
   793
Chengsong
parents:
diff changeset
   794
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Chengsong
parents:
diff changeset
   795
\begin{frame}[c]
Chengsong
parents:
diff changeset
   796
\frametitle{The Meaning of Matching}
Chengsong
parents:
diff changeset
   797
Chengsong
parents:
diff changeset
   798
\begin{bubble}[10cm]
Chengsong
parents:
diff changeset
   799
\large\bf 
Chengsong
parents:
diff changeset
   800
A regular expression \bl{$r$} matches a string~\bl{$s$} 
Chengsong
parents:
diff changeset
   801
provided
Chengsong
parents:
diff changeset
   802
Chengsong
parents:
diff changeset
   803
\begin{center}
Chengsong
parents:
diff changeset
   804
\bl{$s \in L(r)$}\\ 
Chengsong
parents:
diff changeset
   805
\end{center}
Chengsong
parents:
diff changeset
   806
\end{bubble}\bigskip\bigskip
Chengsong
parents:
diff changeset
   807
Chengsong
parents:
diff changeset
   808
\ldots and the point of the next lecture is 
Chengsong
parents:
diff changeset
   809
to decide this problem as fast as possible (unlike Python,
Chengsong
parents:
diff changeset
   810
Ruby, Java)
Chengsong
parents:
diff changeset
   811
Chengsong
parents:
diff changeset
   812
\end{frame}
Chengsong
parents:
diff changeset
   813
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
Chengsong
parents:
diff changeset
   814
Chengsong
parents:
diff changeset
   815
Chengsong
parents:
diff changeset
   816
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Chengsong
parents:
diff changeset
   817
\begin{frame}[c]
Chengsong
parents:
diff changeset
   818
\frametitle{Written Exam}
Chengsong
parents:
diff changeset
   819
Chengsong
parents:
diff changeset
   820
\begin{itemize}
Chengsong
parents:
diff changeset
   821
\item Accounts for 80\%.\bigskip
Chengsong
parents:
diff changeset
   822
Chengsong
parents:
diff changeset
   823
\item The question ``\textit{Is this relevant for
Chengsong
parents:
diff changeset
   824
      the exam?}'' is very demotivating for the lecturer!\bigskip\\
Chengsong
parents:
diff changeset
   825
Chengsong
parents:
diff changeset
   826
\item Deal: Whatever is in the homework (and is not marked
Chengsong
parents:
diff changeset
   827
      ``\textit{optional}'') is relevant for the exam.\bigskip
Chengsong
parents:
diff changeset
   828
      
Chengsong
parents:
diff changeset
   829
\item Each lecture has also a handout. There are also handouts about
Chengsong
parents:
diff changeset
   830
notation and Scala.      
Chengsong
parents:
diff changeset
   831
\end{itemize}
Chengsong
parents:
diff changeset
   832
Chengsong
parents:
diff changeset
   833
\end{frame}
Chengsong
parents:
diff changeset
   834
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
Chengsong
parents:
diff changeset
   835
Chengsong
parents:
diff changeset
   836
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Chengsong
parents:
diff changeset
   837
\begin{frame}[t]
Chengsong
parents:
diff changeset
   838
\frametitle{Coursework}
Chengsong
parents:
diff changeset
   839
Chengsong
parents:
diff changeset
   840
\begin{itemize}
Chengsong
parents:
diff changeset
   841
\item Accounts for 20\%. Two strands. Choose \alert{\bf one}!\bigskip
Chengsong
parents:
diff changeset
   842
\end{itemize}
Chengsong
parents:
diff changeset
   843
Chengsong
parents:
diff changeset
   844
\begin{columns}[t]
Chengsong
parents:
diff changeset
   845
\begin{column}{.5\textwidth}
Chengsong
parents:
diff changeset
   846
\underline{\bf Strand 1}\medskip
Chengsong
parents:
diff changeset
   847
\begin{itemize}
Chengsong
parents:
diff changeset
   848
\item four programming tasks:
Chengsong
parents:
diff changeset
   849
\begin{itemize}
Chengsong
parents:
diff changeset
   850
\item matcher (4\%, 12.10.) 
Chengsong
parents:
diff changeset
   851
\item lexer (5\%, 02.11.)
Chengsong
parents:
diff changeset
   852
\item parser (5\%, 23.11.)
Chengsong
parents:
diff changeset
   853
\item compiler (6\%, 14.12.)
Chengsong
parents:
diff changeset
   854
\end{itemize}
Chengsong
parents:
diff changeset
   855
\item in any lang.~you like,\\ but I want to see the code
Chengsong
parents:
diff changeset
   856
\end{itemize}
Chengsong
parents:
diff changeset
   857
\end{column}
Chengsong
parents:
diff changeset
   858
Chengsong
parents:
diff changeset
   859
\hspace{-45pt}\vrule{}\hspace{10pt}
Chengsong
parents:
diff changeset
   860
\begin{column}{.5\textwidth}
Chengsong
parents:
diff changeset
   861
\underline{\bf Strand 2}\smallskip\begin{itemize}
Chengsong
parents:
diff changeset
   862
\item one task: prove the correctness of a regular expression matcher in 
Chengsong
parents:
diff changeset
   863
the \underline{Isabelle} theorem prover
Chengsong
parents:
diff changeset
   864
\item 20\%, submission on~14.12.\hspace{-5mm}\mbox{}
Chengsong
parents:
diff changeset
   865
\end{itemize}
Chengsong
parents:
diff changeset
   866
\end{column}
Chengsong
parents:
diff changeset
   867
\end{columns}\medskip
Chengsong
parents:
diff changeset
   868
Chengsong
parents:
diff changeset
   869
\small
Chengsong
parents:
diff changeset
   870
\begin{itemize}
Chengsong
parents:
diff changeset
   871
\item Solving more than one strand will {\bf not} give you more 
Chengsong
parents:
diff changeset
   872
marks.
Chengsong
parents:
diff changeset
   873
Chengsong
parents:
diff changeset
   874
\end{itemize}
Chengsong
parents:
diff changeset
   875
Chengsong
parents:
diff changeset
   876
\end{frame}
Chengsong
parents:
diff changeset
   877
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
Chengsong
parents:
diff changeset
   878
Chengsong
parents:
diff changeset
   879
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Chengsong
parents:
diff changeset
   880
\begin{frame}[c]
Chengsong
parents:
diff changeset
   881
\frametitle{Lecture Capture}
Chengsong
parents:
diff changeset
   882
Chengsong
parents:
diff changeset
   883
\begin{itemize}
Chengsong
parents:
diff changeset
   884
\item Hope it works\ldots\pause actually no, it does not!\medskip\pause
Chengsong
parents:
diff changeset
   885
\item It is important to use lecture capture wisely\\ (it is only the ``baseline''):
Chengsong
parents:
diff changeset
   886
\begin{itemize}  
Chengsong
parents:
diff changeset
   887
\item Lecture recordings are a study and revision aid.
Chengsong
parents:
diff changeset
   888
\item Statistically, there is a clear and direct link between attendance and
Chengsong
parents:
diff changeset
   889
  attainment: Students who do not attend lectures, do less well in exams.
Chengsong
parents:
diff changeset
   890
\end{itemize}
Chengsong
parents:
diff changeset
   891
Chengsong
parents:
diff changeset
   892
\item Attending a lecture is more than watching it online -- if you do not
Chengsong
parents:
diff changeset
   893
attend, you miss out!  
Chengsong
parents:
diff changeset
   894
  
Chengsong
parents:
diff changeset
   895
\end{itemize}
Chengsong
parents:
diff changeset
   896
Chengsong
parents:
diff changeset
   897
\end{frame}
Chengsong
parents:
diff changeset
   898
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
Chengsong
parents:
diff changeset
   899
Chengsong
parents:
diff changeset
   900
Chengsong
parents:
diff changeset
   901
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Chengsong
parents:
diff changeset
   902
\begin{frame}[c]
Chengsong
parents:
diff changeset
   903
\frametitle{\begin{tabular}{c}\\[3cm]\alert{Questions?}\end{tabular}}
Chengsong
parents:
diff changeset
   904
Chengsong
parents:
diff changeset
   905
\mbox{}
Chengsong
parents:
diff changeset
   906
\end{frame}
Chengsong
parents:
diff changeset
   907
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
Chengsong
parents:
diff changeset
   908
\end{document}
Chengsong
parents:
diff changeset
   909
Chengsong
parents:
diff changeset
   910
%%% Local Variables:  
Chengsong
parents:
diff changeset
   911
%%% mode: latex
Chengsong
parents:
diff changeset
   912
%%% TeX-master: t
Chengsong
parents:
diff changeset
   913
%%% End: 
Chengsong
parents:
diff changeset
   914