slides/slides06.tex
author Christian Urban <christian dot urban at kcl dot ac dot uk>
Sat, 12 Oct 2013 23:39:20 +0100
changeset 142 1aa28135a2da
parent 93 4794759139ea
child 168 e60c4a9ba340
permissions -rw-r--r--
added
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
49
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     1
\documentclass[dvipsnames,14pt,t]{beamer}
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     2
\usepackage{beamerthemeplainculight}
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     3
\usepackage[T1]{fontenc}
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     4
\usepackage[latin1]{inputenc}
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     5
\usepackage{mathpartir}
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     6
\usepackage[absolute,overlay]{textpos}
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     7
\usepackage{ifthen}
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     8
\usepackage{tikz}
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     9
\usepackage{pgf}
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    10
\usepackage{calc} 
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    11
\usepackage{ulem}
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    12
\usepackage{courier}
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    13
\usepackage{listings}
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    14
\renewcommand{\uline}[1]{#1}
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    15
\usetikzlibrary{arrows}
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    16
\usetikzlibrary{automata}
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    17
\usetikzlibrary{shapes}
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    18
\usetikzlibrary{shadows}
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    19
\usetikzlibrary{positioning}
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    20
\usetikzlibrary{calc}
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    21
\usetikzlibrary{plotmarks}
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    22
\usepackage{graphicx} 
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    23
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    24
\definecolor{javared}{rgb}{0.6,0,0} % for strings
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    25
\definecolor{javagreen}{rgb}{0.25,0.5,0.35} % comments
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    26
\definecolor{javapurple}{rgb}{0.5,0,0.35} % keywords
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    27
\definecolor{javadocblue}{rgb}{0.25,0.35,0.75} % javadoc
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    28
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    29
\lstset{language=Java,
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    30
	basicstyle=\ttfamily,
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    31
	keywordstyle=\color{javapurple}\bfseries,
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    32
	stringstyle=\color{javagreen},
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    33
	commentstyle=\color{javagreen},
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    34
	morecomment=[s][\color{javadocblue}]{/**}{*/},
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    35
	numbers=left,
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    36
	numberstyle=\tiny\color{black},
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    37
	stepnumber=1,
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    38
	numbersep=10pt,
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    39
	tabsize=2,
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    40
	showspaces=false,
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    41
	showstringspaces=false}
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    42
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    43
\lstdefinelanguage{scala}{
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    44
  morekeywords={abstract,case,catch,class,def,%
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    45
    do,else,extends,false,final,finally,%
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    46
    for,if,implicit,import,match,mixin,%
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    47
    new,null,object,override,package,%
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    48
    private,protected,requires,return,sealed,%
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    49
    super,this,throw,trait,true,try,%
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    50
    type,val,var,while,with,yield},
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    51
  otherkeywords={=>,<-,<\%,<:,>:,\#,@},
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    52
  sensitive=true,
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    53
  morecomment=[l]{//},
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    54
  morecomment=[n]{/*}{*/},
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    55
  morestring=[b]",
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    56
  morestring=[b]',
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    57
  morestring=[b]"""
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    58
}
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    59
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    60
\lstset{language=Scala,
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    61
	basicstyle=\ttfamily,
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    62
	keywordstyle=\color{javapurple}\bfseries,
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    63
	stringstyle=\color{javagreen},
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    64
	commentstyle=\color{javagreen},
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    65
	morecomment=[s][\color{javadocblue}]{/**}{*/},
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    66
	numbers=left,
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    67
	numberstyle=\tiny\color{black},
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    68
	stepnumber=1,
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    69
	numbersep=10pt,
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    70
	tabsize=2,
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    71
	showspaces=false,
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    72
	showstringspaces=false}
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    73
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    74
% beamer stuff 
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    75
\renewcommand{\slidecaption}{AFL 06, King's College London, 31.~October 2012}
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    76
\newcommand{\bl}[1]{\textcolor{blue}{#1}}       
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    77
\newcommand{\dn}{\stackrel{\mbox{\scriptsize def}}{=}}% for definitions
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    78
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    79
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    80
% The data files, written on the first run.
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    81
\begin{filecontents}{re-python.data}
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    82
1 0.029
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    83
5 0.029
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    84
10 0.029
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    85
15 0.032
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    86
16 0.042
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    87
17 0.042
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    88
18 0.055
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    89
19 0.084
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    90
20 0.136
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    91
21 0.248
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    92
22 0.464
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    93
23 0.899
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    94
24 1.773
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    95
25 3.505
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    96
26 6.993
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    97
27 14.503
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    98
28 29.307
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    99
#29 58.886
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   100
\end{filecontents}
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   101
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   102
\begin{filecontents}{re1.data}
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   103
1 0.00179
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   104
2 0.00011
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   105
3 0.00014
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   106
4 0.00026
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   107
5 0.00050
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   108
6 0.00095
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   109
7 0.00190
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   110
8 0.00287
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   111
9 0.00779
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   112
10 0.01399
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   113
11 0.01894
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   114
12 0.03666
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   115
13 0.07994
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   116
14 0.08944
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   117
15 0.02377
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   118
16 0.07392
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   119
17 0.22798
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   120
18 0.65310
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   121
19 2.11360
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   122
20 6.31606
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   123
21 21.46013
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   124
\end{filecontents}
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   125
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   126
\begin{filecontents}{re2.data}
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   127
1  0.00240
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   128
2  0.00013
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   129
3  0.00020
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   130
4  0.00030
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   131
5  0.00049
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   132
6  0.00083
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   133
7  0.00146
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   134
8  0.00228
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   135
9  0.00351
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   136
10  0.00640
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   137
11  0.01217
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   138
12  0.02565
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   139
13  0.01382
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   140
14  0.02423
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   141
15  0.05065 
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   142
16  0.06522
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   143
17  0.02140
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   144
18  0.05176
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   145
19  0.18254
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   146
20  0.51898
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   147
21  1.39631
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   148
22  2.69501
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   149
23  8.07952
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   150
\end{filecontents}
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   151
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   152
\begin{filecontents}{re-internal.data}
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   153
1 0.00069
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   154
301 0.00700
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   155
601 0.00297
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   156
901 0.00470
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   157
1201 0.01301
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   158
1501 0.01175
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   159
1801 0.01761
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   160
2101 0.01787
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   161
2401 0.02717
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   162
2701 0.03932
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   163
3001 0.03470
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   164
3301 0.04349
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   165
3601 0.05411
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   166
3901 0.06181
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   167
4201 0.07119
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   168
4501 0.08578
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   169
\end{filecontents}
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   170
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   171
\begin{filecontents}{re3.data}
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   172
1 0.001605
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   173
501 0.131066
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   174
1001 0.057885
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   175
1501 0.136875
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   176
2001 0.176238
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   177
2501 0.254363
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   178
3001 0.37262
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   179
3501 0.500946
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   180
4001 0.638384
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   181
4501 0.816605
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   182
5001 1.00491
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   183
5501 1.232505
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   184
6001 1.525672
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   185
6501 1.757502
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   186
7001 2.092784
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   187
7501 2.429224
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   188
8001 2.803037
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   189
8501 3.463045
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   190
9001 3.609
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   191
9501 4.081504
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   192
10001 4.54569
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   193
\end{filecontents}
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   194
\begin{document}
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   195
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   196
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   197
\mode<presentation>{
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   198
\begin{frame}<1>[t]
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   199
\frametitle{%
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   200
  \begin{tabular}{@ {}c@ {}}
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   201
  \\[-3mm]
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   202
  \LARGE Automata and \\[-2mm] 
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   203
  \LARGE Formal Languages (6)\\[3mm] 
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   204
  \end{tabular}}
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   205
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   206
  \normalsize
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   207
  \begin{center}
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   208
  \begin{tabular}{ll}
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   209
  Email:  & christian.urban at kcl.ac.uk\\
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   210
  Of$\!$fice: & S1.27 (1st floor Strand Building)\\
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   211
  Slides: & KEATS (also home work is there)\\
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   212
  \end{tabular}
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   213
  \end{center}
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   214
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   215
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   216
\end{frame}}
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   217
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%     
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   218
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   219
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   220
\mode<presentation>{
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   221
\begin{frame}[c]
50
Christian Urban <urbanc@in.tum.de>
parents: 49
diff changeset
   222
Christian Urban <urbanc@in.tum.de>
parents: 49
diff changeset
   223
``I hate coding. I do not want to look at code.''
Christian Urban <urbanc@in.tum.de>
parents: 49
diff changeset
   224
Christian Urban <urbanc@in.tum.de>
parents: 49
diff changeset
   225
\end{frame}}
Christian Urban <urbanc@in.tum.de>
parents: 49
diff changeset
   226
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
Christian Urban <urbanc@in.tum.de>
parents: 49
diff changeset
   227
Christian Urban <urbanc@in.tum.de>
parents: 49
diff changeset
   228
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Christian Urban <urbanc@in.tum.de>
parents: 49
diff changeset
   229
\mode<presentation>{
Christian Urban <urbanc@in.tum.de>
parents: 49
diff changeset
   230
\begin{frame}[c]
Christian Urban <urbanc@in.tum.de>
parents: 49
diff changeset
   231
Christian Urban <urbanc@in.tum.de>
parents: 49
diff changeset
   232
``I am appalled. You do not show code anymore.''
Christian Urban <urbanc@in.tum.de>
parents: 49
diff changeset
   233
Christian Urban <urbanc@in.tum.de>
parents: 49
diff changeset
   234
\end{frame}}
Christian Urban <urbanc@in.tum.de>
parents: 49
diff changeset
   235
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
Christian Urban <urbanc@in.tum.de>
parents: 49
diff changeset
   236
Christian Urban <urbanc@in.tum.de>
parents: 49
diff changeset
   237
Christian Urban <urbanc@in.tum.de>
parents: 49
diff changeset
   238
Christian Urban <urbanc@in.tum.de>
parents: 49
diff changeset
   239
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Christian Urban <urbanc@in.tum.de>
parents: 49
diff changeset
   240
\mode<presentation>{
Christian Urban <urbanc@in.tum.de>
parents: 49
diff changeset
   241
\begin{frame}[c]
49
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   242
\frametitle{\begin{tabular}{c}ReDoS\end{tabular}}
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   243
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   244
\begin{itemize}
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   245
\item \alert{R}egular \alert{e}xpression \alert{D}enial \alert{o}f \alert{S}ervice\bigskip
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   246
\item ``Regular Expressions Will Stab You in the Back''\bigskip
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   247
\item Evil regular expressions\medskip
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   248
\begin{itemize}
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   249
\item \bl{$(a?\{n\})a\{n\}$}
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   250
\item \bl{$(a^+)^+$}
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   251
\item \bl{$([a-zA-Z]^+)^*$}
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   252
\item \bl{$(a + aa)^+$}
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   253
\item \bl{$(a + a?)^+$}
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   254
\end{itemize}
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   255
\end{itemize}
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   256
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   257
\end{frame}}
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   258
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   259
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   260
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   261
\mode<presentation>{
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   262
\begin{frame}[c]
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   263
\frametitle{\begin{tabular}{c}Regexp Matching\end{tabular}}
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   264
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   265
Given a regular expression
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   266
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   267
\begin{enumerate}
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   268
\item you might convert it into a DFA (subset construction)
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   269
\item you might try all possible paths in an NFA via backtracking
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   270
\item you might try all paths in an NFA in parallel
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   271
\item you might try to convert the DFA ``lazily''
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   272
\end{enumerate}\bigskip
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   273
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   274
Often No~2 is implemented (sometimes there are even good reasons for doing this).
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   275
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   276
\end{frame}}
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   277
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   278
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   279
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   280
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   281
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   282
\mode<presentation>{
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   283
\begin{frame}[c]
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   284
\frametitle{\begin{tabular}{c}\bl{$(a?\{n\})a\{n\}$} in Python\end{tabular}}
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   285
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   286
\begin{tikzpicture}[y=.2cm, x=.3cm]
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   287
 	%axis
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   288
	\draw (0,0) -- coordinate (x axis mid) (30,0);
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   289
    	\draw (0,0) -- coordinate (y axis mid) (0,30);
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   290
    	%ticks
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   291
    	\foreach \x in {0,5,...,30}
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   292
     		\draw (\x,1pt) -- (\x,-3pt)
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   293
			node[anchor=north] {\x};
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   294
    	\foreach \y in {0,5,...,30}
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   295
     		\draw (1pt,\y) -- (-3pt,\y) 
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   296
     			node[anchor=east] {\y}; 
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   297
	%labels      
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   298
	\node[below=0.6cm] at (x axis mid) {\bl{a}s};
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   299
	\node[rotate=90, left=1.2cm] at (y axis mid) {secs};
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   300
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   301
	%plots
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   302
	\draw[color=blue] plot[mark=*, mark options={fill=white}] 
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   303
		file {re-python.data};
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   304
	\only<2->{
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   305
	\draw[color=red] plot[mark=triangle*, mark options={fill=white} ] 
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   306
		file {re1.data};}
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   307
	\only<3->{	 
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   308
         \draw[color=green] plot[mark=square*, mark options={fill=white} ] 
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   309
		file {re2.data};}
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   310
    
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   311
	%legend
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   312
	\begin{scope}[shift={(4,20)}] 
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   313
	\draw[color=blue] (0,0) -- 
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   314
		plot[mark=*, mark options={fill=white}] (0.25,0) -- (0.5,0) 
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   315
		node[right]{\small Python};
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   316
	\only<2->{\draw[yshift=\baselineskip, color=red] (0,0) -- 
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   317
		plot[mark=triangle*, mark options={fill=white}] (0.25,0) -- (0.5,0)
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   318
		node[right]{\small Scala V1};}
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   319
	\only<3->{	
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   320
	 \draw[yshift=2\baselineskip, color=green] (0,0) -- 
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   321
		plot[mark=square*, mark options={fill=white}] (0.25,0) -- (0.5,0)
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   322
		node[right]{\small Scala V2 with simplifications};}
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   323
	\end{scope}
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   324
\end{tikzpicture}
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   325
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   326
\end{frame}}
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   327
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   328
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   329
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   330
\mode<presentation>{
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   331
\begin{frame}[c]
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   332
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   333
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   334
\begin{tikzpicture}[y=.7cm, x=.0009cm]
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   335
 	%axis
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   336
	\draw (0,0) -- coordinate (x axis mid) (10000,0);
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   337
    	\draw (0,0) -- coordinate (y axis mid) (0,6);
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   338
    	%ticks
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   339
    	\foreach \x in {0,2000,...,10000}
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   340
     		\draw (\x,1pt) -- (\x,-3pt)
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   341
			node[anchor=north] {\x};
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   342
    	\foreach \y in {0,1,...,6}
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   343
     		\draw (1pt,\y) -- (-3pt,\y) 
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   344
     			node[anchor=east] {\y}; 
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   345
	%labels      
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   346
	\node[below=0.6cm] at (x axis mid) {\bl{a}s};
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   347
	\node[rotate=90, left=1.2cm] at (y axis mid) {secs};
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   348
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   349
	%plots
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   350
	\draw[color=blue] plot[mark=*, mark options={fill=white}] 
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   351
		file {re-internal.data};
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   352
	\only<2->{	 
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   353
         \draw[color=red] plot[mark=triangle*, mark options={fill=white} ] 
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   354
		file {re3.data};}
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   355
    
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   356
	%legend
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   357
	\begin{scope}[shift={(2000,4)}] 
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   358
	\draw[color=blue] (0,0) -- 
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   359
		plot[mark=*, mark options={fill=white}] (0.25,0) -- (0.5,0) 
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   360
		node[right]{\small Scala Internal};
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   361
        \only<2->{
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   362
	\draw[yshift=\baselineskip, color=red] (0,0) -- 
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   363
		plot[mark=triangle*, mark options={fill=white}] (0.25,0) -- (0.5,0)
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   364
		node[right]{\small Scala V3 with explicit $\_\{\_\}$};}
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   365
	\end{scope}
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   366
\end{tikzpicture}
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   367
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   368
\end{frame}}
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   369
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   370
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   371
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   372
50
Christian Urban <urbanc@in.tum.de>
parents: 49
diff changeset
   373
\newcommand{\qq}{\mbox{\texttt{"}}}
49
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   374
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   375
\mode<presentation>{
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   376
\begin{frame}[c]
50
Christian Urban <urbanc@in.tum.de>
parents: 49
diff changeset
   377
\frametitle{\begin{tabular}{c}Grammars\end{tabular}}
Christian Urban <urbanc@in.tum.de>
parents: 49
diff changeset
   378
53
Christian Urban <urbanc@in.tum.de>
parents: 52
diff changeset
   379
A (context-free) grammar \bl{$G$} consists of
49
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   380
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   381
\begin{itemize}
50
Christian Urban <urbanc@in.tum.de>
parents: 49
diff changeset
   382
\item a finite set of nonterminal symbols (upper case)
Christian Urban <urbanc@in.tum.de>
parents: 49
diff changeset
   383
\item a finite terminal symbols or tokens (lower case)
Christian Urban <urbanc@in.tum.de>
parents: 49
diff changeset
   384
\item a start symbol (which must be a nonterminal)
Christian Urban <urbanc@in.tum.de>
parents: 49
diff changeset
   385
\item a set of rules
49
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   386
\begin{center}
50
Christian Urban <urbanc@in.tum.de>
parents: 49
diff changeset
   387
\bl{$A \rightarrow \text{rhs}$}
49
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   388
\end{center}
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   389
50
Christian Urban <urbanc@in.tum.de>
parents: 49
diff changeset
   390
where \bl{rhs} are sequences involving terminals and nonterminals.\medskip\pause
49
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   391
50
Christian Urban <urbanc@in.tum.de>
parents: 49
diff changeset
   392
We can also allow rules
Christian Urban <urbanc@in.tum.de>
parents: 49
diff changeset
   393
\begin{center}
Christian Urban <urbanc@in.tum.de>
parents: 49
diff changeset
   394
\bl{$A \rightarrow \text{rhs}_1 | \text{rhs}_2 | \ldots$}
Christian Urban <urbanc@in.tum.de>
parents: 49
diff changeset
   395
\end{center}
Christian Urban <urbanc@in.tum.de>
parents: 49
diff changeset
   396
\end{itemize}
49
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   397
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   398
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   399
\end{frame}}
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   400
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   401
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   402
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   403
\mode<presentation>{
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   404
\begin{frame}[c]
50
Christian Urban <urbanc@in.tum.de>
parents: 49
diff changeset
   405
\frametitle{\begin{tabular}{c}Palindromes\end{tabular}}
49
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   406
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   407
\begin{center}
50
Christian Urban <urbanc@in.tum.de>
parents: 49
diff changeset
   408
\bl{\begin{tabular}{lcl}
Christian Urban <urbanc@in.tum.de>
parents: 49
diff changeset
   409
$S$ & $\rightarrow$ &  $\epsilon$ \\
53
Christian Urban <urbanc@in.tum.de>
parents: 52
diff changeset
   410
$S$ & $\rightarrow$ &  $a\cdot S\cdot a$ \\
Christian Urban <urbanc@in.tum.de>
parents: 52
diff changeset
   411
$S$ & $\rightarrow$ &  $b\cdot S\cdot b$ \\
50
Christian Urban <urbanc@in.tum.de>
parents: 49
diff changeset
   412
\end{tabular}}
Christian Urban <urbanc@in.tum.de>
parents: 49
diff changeset
   413
\end{center}\pause
Christian Urban <urbanc@in.tum.de>
parents: 49
diff changeset
   414
Christian Urban <urbanc@in.tum.de>
parents: 49
diff changeset
   415
or
Christian Urban <urbanc@in.tum.de>
parents: 49
diff changeset
   416
Christian Urban <urbanc@in.tum.de>
parents: 49
diff changeset
   417
\begin{center}
Christian Urban <urbanc@in.tum.de>
parents: 49
diff changeset
   418
\bl{\begin{tabular}{lcl}
53
Christian Urban <urbanc@in.tum.de>
parents: 52
diff changeset
   419
$S$ & $\rightarrow$ &  $\epsilon \;|\; a\cdot S\cdot a \;|\;b\cdot S\cdot b$ \\
50
Christian Urban <urbanc@in.tum.de>
parents: 49
diff changeset
   420
\end{tabular}}
49
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   421
\end{center}
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   422
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   423
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   424
\end{frame}}
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   425
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   426
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   427
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   428
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   429
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   430
\mode<presentation>{
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   431
\begin{frame}[c]
50
Christian Urban <urbanc@in.tum.de>
parents: 49
diff changeset
   432
\frametitle{\begin{tabular}{c}Arithmetic Expressions\end{tabular}}
49
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   433
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   434
\begin{center}
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   435
\bl{\begin{tabular}{lcl}
50
Christian Urban <urbanc@in.tum.de>
parents: 49
diff changeset
   436
$E$ & $\rightarrow$ &  $num\_token$ \\
53
Christian Urban <urbanc@in.tum.de>
parents: 52
diff changeset
   437
$E$ & $\rightarrow$ &  $E \cdot + \cdot E$ \\
Christian Urban <urbanc@in.tum.de>
parents: 52
diff changeset
   438
$E$ & $\rightarrow$ &  $E \cdot - \cdot E$ \\
Christian Urban <urbanc@in.tum.de>
parents: 52
diff changeset
   439
$E$ & $\rightarrow$ &  $E \cdot * \cdot E$ \\
Christian Urban <urbanc@in.tum.de>
parents: 52
diff changeset
   440
$E$ & $\rightarrow$ &  $( \cdot E \cdot )$ 
49
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   441
\end{tabular}}
50
Christian Urban <urbanc@in.tum.de>
parents: 49
diff changeset
   442
\end{center}\pause
49
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   443
50
Christian Urban <urbanc@in.tum.de>
parents: 49
diff changeset
   444
\bl{\texttt{1 + 2 * 3 + 4}}
49
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   445
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   446
\end{frame}}
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   447
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   448
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   449
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   450
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   451
\mode<presentation>{
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   452
\begin{frame}[c]
50
Christian Urban <urbanc@in.tum.de>
parents: 49
diff changeset
   453
\frametitle{\begin{tabular}{c}Parse Trees\end{tabular}}
49
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   454
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   455
\begin{center}
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   456
\bl{\begin{tabular}{lcl}
53
Christian Urban <urbanc@in.tum.de>
parents: 52
diff changeset
   457
$E$ & $\rightarrow$ &  $F \;|\; F \cdot * \cdot F$\\
Christian Urban <urbanc@in.tum.de>
parents: 52
diff changeset
   458
$F$ & $\rightarrow$ & $T \;|\; T \cdot + \cdot T \;|\; T \cdot - \cdot T$\\
Christian Urban <urbanc@in.tum.de>
parents: 52
diff changeset
   459
$T$ & $\rightarrow$ & $num\_token \;|\; ( \cdot E \cdot )$\\
49
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   460
\end{tabular}}
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   461
\end{center}
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   462
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   463
\begin{center}
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   464
\begin{tikzpicture}[level distance=8mm, blue]
50
Christian Urban <urbanc@in.tum.de>
parents: 49
diff changeset
   465
  \node {$E$}
Christian Urban <urbanc@in.tum.de>
parents: 49
diff changeset
   466
    child {node {$F$} 
Christian Urban <urbanc@in.tum.de>
parents: 49
diff changeset
   467
     child {node {$T$} 
Christian Urban <urbanc@in.tum.de>
parents: 49
diff changeset
   468
                 child {node {(\,$E$\,)}
Christian Urban <urbanc@in.tum.de>
parents: 49
diff changeset
   469
                            child {node{$F$ *{} $F$}
Christian Urban <urbanc@in.tum.de>
parents: 49
diff changeset
   470
                                  child {node {$T$} child {node {2}}}
Christian Urban <urbanc@in.tum.de>
parents: 49
diff changeset
   471
                                  child {node {$T$} child {node {3}}} 
49
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   472
                               }
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   473
                          }
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   474
              }
50
Christian Urban <urbanc@in.tum.de>
parents: 49
diff changeset
   475
     child {node {+}}
Christian Urban <urbanc@in.tum.de>
parents: 49
diff changeset
   476
     child {node {$T$}
Christian Urban <urbanc@in.tum.de>
parents: 49
diff changeset
   477
       child {node {(\,$E$\,)} 
Christian Urban <urbanc@in.tum.de>
parents: 49
diff changeset
   478
       child {node {$F$}
Christian Urban <urbanc@in.tum.de>
parents: 49
diff changeset
   479
       child {node {$T$ +{} $T$}
49
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   480
                    child {node {3}}
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   481
                    child {node {4}} 
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   482
                 }
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   483
                 }}
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   484
    }};
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   485
\end{tikzpicture}
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   486
\end{center}
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   487
50
Christian Urban <urbanc@in.tum.de>
parents: 49
diff changeset
   488
\begin{textblock}{5}(1, 6.5)
49
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   489
\bl{\texttt{(2*3)+(3+4)}}
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   490
\end{textblock}
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   491
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   492
\end{frame}}
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   493
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
50
Christian Urban <urbanc@in.tum.de>
parents: 49
diff changeset
   494
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Christian Urban <urbanc@in.tum.de>
parents: 49
diff changeset
   495
\mode<presentation>{
Christian Urban <urbanc@in.tum.de>
parents: 49
diff changeset
   496
\begin{frame}[c]
Christian Urban <urbanc@in.tum.de>
parents: 49
diff changeset
   497
\frametitle{\begin{tabular}{c}Ambiguous Grammars\end{tabular}}
Christian Urban <urbanc@in.tum.de>
parents: 49
diff changeset
   498
Christian Urban <urbanc@in.tum.de>
parents: 49
diff changeset
   499
A grammar is \alert{ambiguous} if there is a string that has at least parse trees.
Christian Urban <urbanc@in.tum.de>
parents: 49
diff changeset
   500
Christian Urban <urbanc@in.tum.de>
parents: 49
diff changeset
   501
Christian Urban <urbanc@in.tum.de>
parents: 49
diff changeset
   502
\begin{center}
Christian Urban <urbanc@in.tum.de>
parents: 49
diff changeset
   503
\bl{\begin{tabular}{lcl}
Christian Urban <urbanc@in.tum.de>
parents: 49
diff changeset
   504
$E$ & $\rightarrow$ &  $num\_token$ \\
53
Christian Urban <urbanc@in.tum.de>
parents: 52
diff changeset
   505
$E$ & $\rightarrow$ &  $E \cdot + \cdot E$ \\
Christian Urban <urbanc@in.tum.de>
parents: 52
diff changeset
   506
$E$ & $\rightarrow$ &  $E \cdot - \cdot E$ \\
Christian Urban <urbanc@in.tum.de>
parents: 52
diff changeset
   507
$E$ & $\rightarrow$ &  $E \cdot * \cdot E$ \\
Christian Urban <urbanc@in.tum.de>
parents: 52
diff changeset
   508
$E$ & $\rightarrow$ &  $( \cdot E \cdot )$ 
50
Christian Urban <urbanc@in.tum.de>
parents: 49
diff changeset
   509
\end{tabular}}
Christian Urban <urbanc@in.tum.de>
parents: 49
diff changeset
   510
\end{center}
Christian Urban <urbanc@in.tum.de>
parents: 49
diff changeset
   511
Christian Urban <urbanc@in.tum.de>
parents: 49
diff changeset
   512
\bl{\texttt{1 + 2 * 3 + 4}}
Christian Urban <urbanc@in.tum.de>
parents: 49
diff changeset
   513
Christian Urban <urbanc@in.tum.de>
parents: 49
diff changeset
   514
\end{frame}}
Christian Urban <urbanc@in.tum.de>
parents: 49
diff changeset
   515
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
Christian Urban <urbanc@in.tum.de>
parents: 49
diff changeset
   516
Christian Urban <urbanc@in.tum.de>
parents: 49
diff changeset
   517
Christian Urban <urbanc@in.tum.de>
parents: 49
diff changeset
   518
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Christian Urban <urbanc@in.tum.de>
parents: 49
diff changeset
   519
\mode<presentation>{
Christian Urban <urbanc@in.tum.de>
parents: 49
diff changeset
   520
\begin{frame}[c]
Christian Urban <urbanc@in.tum.de>
parents: 49
diff changeset
   521
\frametitle{\begin{tabular}{c}Chomsky Normal Form\end{tabular}}
Christian Urban <urbanc@in.tum.de>
parents: 49
diff changeset
   522
Christian Urban <urbanc@in.tum.de>
parents: 49
diff changeset
   523
All rules must be of the form
Christian Urban <urbanc@in.tum.de>
parents: 49
diff changeset
   524
Christian Urban <urbanc@in.tum.de>
parents: 49
diff changeset
   525
\begin{center}
Christian Urban <urbanc@in.tum.de>
parents: 49
diff changeset
   526
\bl{$A \rightarrow a$}
Christian Urban <urbanc@in.tum.de>
parents: 49
diff changeset
   527
\end{center}
Christian Urban <urbanc@in.tum.de>
parents: 49
diff changeset
   528
Christian Urban <urbanc@in.tum.de>
parents: 49
diff changeset
   529
or
Christian Urban <urbanc@in.tum.de>
parents: 49
diff changeset
   530
Christian Urban <urbanc@in.tum.de>
parents: 49
diff changeset
   531
\begin{center}
53
Christian Urban <urbanc@in.tum.de>
parents: 52
diff changeset
   532
\bl{$A \rightarrow B\cdot C$}
50
Christian Urban <urbanc@in.tum.de>
parents: 49
diff changeset
   533
\end{center}
Christian Urban <urbanc@in.tum.de>
parents: 49
diff changeset
   534
Christian Urban <urbanc@in.tum.de>
parents: 49
diff changeset
   535
Christian Urban <urbanc@in.tum.de>
parents: 49
diff changeset
   536
Christian Urban <urbanc@in.tum.de>
parents: 49
diff changeset
   537
\end{frame}}
Christian Urban <urbanc@in.tum.de>
parents: 49
diff changeset
   538
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
53
Christian Urban <urbanc@in.tum.de>
parents: 52
diff changeset
   539
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Christian Urban <urbanc@in.tum.de>
parents: 52
diff changeset
   540
\mode<presentation>{
Christian Urban <urbanc@in.tum.de>
parents: 52
diff changeset
   541
\begin{frame}[c]
Christian Urban <urbanc@in.tum.de>
parents: 52
diff changeset
   542
\frametitle{\begin{tabular}{c}CYK Algorithm\end{tabular}}
50
Christian Urban <urbanc@in.tum.de>
parents: 49
diff changeset
   543
53
Christian Urban <urbanc@in.tum.de>
parents: 52
diff changeset
   544
Christian Urban <urbanc@in.tum.de>
parents: 52
diff changeset
   545
\begin{center}
Christian Urban <urbanc@in.tum.de>
parents: 52
diff changeset
   546
\bl{\begin{tabular}{@ {}lcl}
Christian Urban <urbanc@in.tum.de>
parents: 52
diff changeset
   547
$S$ & $\rightarrow$ &  $N\cdot P$ \\
Christian Urban <urbanc@in.tum.de>
parents: 52
diff changeset
   548
$P$ & $\rightarrow$ &  $V\cdot N$ \\
Christian Urban <urbanc@in.tum.de>
parents: 52
diff changeset
   549
$N$ & $\rightarrow$ &  $N\cdot N$ \\
Christian Urban <urbanc@in.tum.de>
parents: 52
diff changeset
   550
$N$ & $\rightarrow$ &  $\texttt{students} \;|\; \texttt{Jeff} \;|\; \texttt{geometry} \;|\; \texttt{trains} $ \\
56
Christian Urban <urbanc@in.tum.de>
parents: 53
diff changeset
   551
$V$ & $\rightarrow$ &  $\texttt{trains}$ 
53
Christian Urban <urbanc@in.tum.de>
parents: 52
diff changeset
   552
\end{tabular}}
Christian Urban <urbanc@in.tum.de>
parents: 52
diff changeset
   553
\end{center}
Christian Urban <urbanc@in.tum.de>
parents: 52
diff changeset
   554
Christian Urban <urbanc@in.tum.de>
parents: 52
diff changeset
   555
\bl{\texttt{Jeff trains geometry students}}
Christian Urban <urbanc@in.tum.de>
parents: 52
diff changeset
   556
Christian Urban <urbanc@in.tum.de>
parents: 52
diff changeset
   557
\end{frame}}
Christian Urban <urbanc@in.tum.de>
parents: 52
diff changeset
   558
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
51
6fe4facb56a6 updated
Christian Urban <urbanc@in.tum.de>
parents: 50
diff changeset
   559
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6fe4facb56a6 updated
Christian Urban <urbanc@in.tum.de>
parents: 50
diff changeset
   560
\mode<presentation>{
6fe4facb56a6 updated
Christian Urban <urbanc@in.tum.de>
parents: 50
diff changeset
   561
\begin{frame}[c]
6fe4facb56a6 updated
Christian Urban <urbanc@in.tum.de>
parents: 50
diff changeset
   562
\frametitle{\begin{tabular}{c}CYK Algorithm\end{tabular}}
50
Christian Urban <urbanc@in.tum.de>
parents: 49
diff changeset
   563
49
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   564
52
Christian Urban <urbanc@in.tum.de>
parents: 51
diff changeset
   565
\begin{itemize}
Christian Urban <urbanc@in.tum.de>
parents: 51
diff changeset
   566
\item runtime is \bl{$O(n^3)$}\bigskip
Christian Urban <urbanc@in.tum.de>
parents: 51
diff changeset
   567
\item grammars need to be transferred into CNF
Christian Urban <urbanc@in.tum.de>
parents: 51
diff changeset
   568
\end{itemize}
51
6fe4facb56a6 updated
Christian Urban <urbanc@in.tum.de>
parents: 50
diff changeset
   569
6fe4facb56a6 updated
Christian Urban <urbanc@in.tum.de>
parents: 50
diff changeset
   570
\end{frame}}
6fe4facb56a6 updated
Christian Urban <urbanc@in.tum.de>
parents: 50
diff changeset
   571
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
6fe4facb56a6 updated
Christian Urban <urbanc@in.tum.de>
parents: 50
diff changeset
   572
49
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   573
\end{document}
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   574
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   575
%%% Local Variables:  
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   576
%%% mode: latex
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   577
%%% TeX-master: t
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   578
%%% End: 
d2c6852ca8da added programs and slides
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   579