slides09.tex
author Christian Urban <christian dot urban at kcl dot ac dot uk>
Sat, 24 Nov 2012 14:58:27 +0000
changeset 77 49c0beef79a1
parent 76 373cf55a3ca5
child 79 fd894e017e12
permissions -rw-r--r--
added
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
65
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
     1
\documentclass[dvipsnames,14pt,t]{beamer}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
     2
\usepackage{beamerthemeplainculight}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
     3
\usepackage[T1]{fontenc}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
     4
\usepackage[latin1]{inputenc}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
     5
\usepackage{mathpartir}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
     6
\usepackage[absolute,overlay]{textpos}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
     7
\usepackage{ifthen}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
     8
\usepackage{tikz}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
     9
\usepackage{pgf}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    10
\usepackage{calc} 
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    11
\usepackage{ulem}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    12
\usepackage{courier}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    13
\usepackage{listings}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    14
\renewcommand{\uline}[1]{#1}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    15
\usetikzlibrary{arrows}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    16
\usetikzlibrary{automata}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    17
\usetikzlibrary{shapes}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    18
\usetikzlibrary{shadows}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    19
\usetikzlibrary{positioning}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    20
\usetikzlibrary{calc}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    21
\usetikzlibrary{plotmarks}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    22
\usepackage{graphicx} 
77
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 76
diff changeset
    23
\usepackage{pgfplots}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 76
diff changeset
    24
65
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    25
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    26
\definecolor{javared}{rgb}{0.6,0,0} % for strings
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    27
\definecolor{javagreen}{rgb}{0.25,0.5,0.35} % comments
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    28
\definecolor{javapurple}{rgb}{0.5,0,0.35} % keywords
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    29
\definecolor{javadocblue}{rgb}{0.25,0.35,0.75} % javadoc
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    30
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    31
\lstset{language=Java,
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    32
	basicstyle=\ttfamily,
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    33
	keywordstyle=\color{javapurple}\bfseries,
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    34
	stringstyle=\color{javagreen},
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    35
	commentstyle=\color{javagreen},
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    36
	morecomment=[s][\color{javadocblue}]{/**}{*/},
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    37
	numbers=left,
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    38
	numberstyle=\tiny\color{black},
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    39
	stepnumber=1,
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    40
	numbersep=10pt,
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    41
	tabsize=2,
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    42
	showspaces=false,
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    43
	showstringspaces=false}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    44
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    45
\lstdefinelanguage{scala}{
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    46
  morekeywords={abstract,case,catch,class,def,%
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    47
    do,else,extends,false,final,finally,%
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    48
    for,if,implicit,import,match,mixin,%
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    49
    new,null,object,override,package,%
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    50
    private,protected,requires,return,sealed,%
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    51
    super,this,throw,trait,true,try,%
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    52
    type,val,var,while,with,yield},
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    53
  otherkeywords={=>,<-,<\%,<:,>:,\#,@},
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    54
  sensitive=true,
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    55
  morecomment=[l]{//},
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    56
  morecomment=[n]{/*}{*/},
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    57
  morestring=[b]",
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    58
  morestring=[b]',
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    59
  morestring=[b]"""
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    60
}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    61
77
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 76
diff changeset
    62
65
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    63
\lstset{language=Scala,
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    64
	basicstyle=\ttfamily,
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    65
	keywordstyle=\color{javapurple}\bfseries,
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    66
	stringstyle=\color{javagreen},
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    67
	commentstyle=\color{javagreen},
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    68
	morecomment=[s][\color{javadocblue}]{/**}{*/},
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    69
	numbers=left,
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    70
	numberstyle=\tiny\color{black},
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    71
	stepnumber=1,
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    72
	numbersep=10pt,
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    73
	tabsize=2,
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    74
	showspaces=false,
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    75
	showstringspaces=false}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    76
77
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 76
diff changeset
    77
\lstdefinelanguage{while}{
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 76
diff changeset
    78
  morekeywords={if,then,else,while,do,true,false},
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 76
diff changeset
    79
  otherkeywords={=,!=,:=,<,>},
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 76
diff changeset
    80
  sensitive=true,
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 76
diff changeset
    81
  morecomment=[n]{/*}{*/},
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 76
diff changeset
    82
}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 76
diff changeset
    83
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 76
diff changeset
    84
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 76
diff changeset
    85
\lstset{language=While,
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 76
diff changeset
    86
	basicstyle=\ttfamily,
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 76
diff changeset
    87
	keywordstyle=\color{javapurple}\bfseries,
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 76
diff changeset
    88
	stringstyle=\color{javagreen},
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 76
diff changeset
    89
	commentstyle=\color{javagreen},
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 76
diff changeset
    90
	morecomment=[s][\color{javadocblue}]{/**}{*/},
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 76
diff changeset
    91
	numbers=left,
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 76
diff changeset
    92
	numberstyle=\tiny\color{black},
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 76
diff changeset
    93
	stepnumber=1,
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 76
diff changeset
    94
	numbersep=10pt,
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 76
diff changeset
    95
	tabsize=2,
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 76
diff changeset
    96
	showspaces=false,
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 76
diff changeset
    97
	showstringspaces=false}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 76
diff changeset
    98
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 76
diff changeset
    99
65
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   100
% beamer stuff 
76
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 70
diff changeset
   101
\renewcommand{\slidecaption}{AFL 09, King's College London, 28.~November 2012}
65
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   102
\newcommand{\bl}[1]{\textcolor{blue}{#1}}       
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   103
\newcommand{\dn}{\stackrel{\mbox{\scriptsize def}}{=}}% for definitions
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   104
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   105
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   106
% The data files, written on the first run.
77
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 76
diff changeset
   107
\begin{filecontents}{compiled.data}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 76
diff changeset
   108
1 0.0207
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 76
diff changeset
   109
5000 0.0217
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 76
diff changeset
   110
10000 0.0297
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 76
diff changeset
   111
50000 0.1034
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 76
diff changeset
   112
100000 0.3873
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 76
diff changeset
   113
500000 1.27949
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 76
diff changeset
   114
1000000 5. 35424
65
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   115
\end{filecontents}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   116
77
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 76
diff changeset
   117
\begin{filecontents}{interpreted.data}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 76
diff changeset
   118
65
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   119
\end{filecontents}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   120
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   121
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   122
\begin{document}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   123
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   124
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   125
\mode<presentation>{
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   126
\begin{frame}<1>[t]
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   127
\frametitle{%
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   128
  \begin{tabular}{@ {}c@ {}}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   129
  \\[-3mm]
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   130
  \LARGE Automata and \\[-2mm] 
76
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 70
diff changeset
   131
  \LARGE Formal Languages (9)\\[3mm] 
65
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   132
  \end{tabular}}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   133
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   134
  \normalsize
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   135
  \begin{center}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   136
  \begin{tabular}{ll}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   137
  Email:  & christian.urban at kcl.ac.uk\\
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   138
  Of$\!$fice: & S1.27 (1st floor Strand Building)\\
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   139
  Slides: & KEATS (also home work is there)\\
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   140
  \end{tabular}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   141
  \end{center}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   142
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   143
\end{frame}}
77
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 76
diff changeset
   144
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%     
65
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   145
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   146
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   147
\mode<presentation>{
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   148
\begin{frame}[c]
77
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 76
diff changeset
   149
\frametitle{\begin{tabular}{c}While-Language\end{tabular}}
66
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   150
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   151
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   152
\begin{center}
77
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 76
diff changeset
   153
\bl{\begin{tabular}{@{}lcl@{}}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 76
diff changeset
   154
$Stmt$ & $\rightarrow$ &  $\text{skip}$\\
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 76
diff changeset
   155
              & $|$ & $Id := AExp$\\
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 76
diff changeset
   156
              & $|$ & $\text{if}\; B\!Exp \;\text{then}\; Block \;\text{else}\; Block$\\
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 76
diff changeset
   157
              & $|$ & $\text{while}\; B\!Exp \;\text{do}\; Block$\\
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 76
diff changeset
   158
               & $|$ & $\alert{\text{write}\; Id}$\medskip\\
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 76
diff changeset
   159
$Stmts$ & $\rightarrow$ &  $Stmt \;\text{;}\; Stmts$\\
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 76
diff changeset
   160
              & $|$ & $Stmt$\medskip\\
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 76
diff changeset
   161
$Block$ & $\rightarrow$ &  $\{ Stmts \}$\\
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 76
diff changeset
   162
                & $|$ & $Stmt$\medskip\\
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 76
diff changeset
   163
$AExp$ & $\rightarrow$ & \ldots\\
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 76
diff changeset
   164
$BExp$ & $\rightarrow$ & \ldots\\
66
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   165
\end{tabular}}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   166
\end{center}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   167
77
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 76
diff changeset
   168
66
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   169
\end{frame}}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   170
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   171
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   172
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   173
\mode<presentation>{
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   174
\begin{frame}[c]
77
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 76
diff changeset
   175
\frametitle{\begin{tabular}{c}Fibonacci Numbers\end{tabular}}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 76
diff changeset
   176
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 76
diff changeset
   177
\mbox{}\\[-18mm]\mbox{}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 76
diff changeset
   178
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 76
diff changeset
   179
{\lstset{language=While}\fontsize{10}{12}\selectfont
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 76
diff changeset
   180
\texttt{\lstinputlisting{app9.while}}}
66
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   181
77
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 76
diff changeset
   182
\end{frame}}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 76
diff changeset
   183
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 76
diff changeset
   184
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 76
diff changeset
   185
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 76
diff changeset
   186
\mode<presentation>{
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 76
diff changeset
   187
\begin{frame}[c]
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 76
diff changeset
   188
\frametitle{\begin{tabular}{c}Interpreter\end{tabular}}
66
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   189
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   190
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   191
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   192
\end{frame}}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   193
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   194
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   195
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   196
\mode<presentation>{
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   197
\begin{frame}[c]
70
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 69
diff changeset
   198
\frametitle{\begin{tabular}{c}Interpreting a List of Tokens\end{tabular}}
66
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   199
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   200
The lexer cannot prevent errors like
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   201
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   202
\begin{center}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   203
\bl{$<\!b\!>$} \ldots \bl{$<\!p\!>$} \ldots \bl{$<\!\slash{}b\!>$} \ldots \bl{$<\!\slash{}p\!>$} 
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   204
\end{center}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   205
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   206
or
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   207
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   208
\begin{center}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   209
\bl{$<\!\slash{}b\!>$} \ldots \bl{$<\!b\!>$}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   210
\end{center}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   211
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   212
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   213
\end{frame}}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   214
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   215
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   216
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   217
\mode<presentation>{
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   218
\begin{frame}[c]
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   219
\frametitle{\begin{tabular}{c}Parser Combinators\end{tabular}}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   220
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   221
Parser combinators: \bigskip
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   222
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   223
\begin{minipage}{1.1\textwidth}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   224
\begin{center}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   225
\mbox{}\hspace{-12mm}\mbox{}$\underbrace{\text{list of tokens}}_{\text{input}}$ \bl{$\Rightarrow$} 
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   226
$\underbrace{\text{set of (parsed input, unparsed input)}}_{\text{output}}$
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   227
\end{center}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   228
\end{minipage}\bigskip
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   229
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   230
\begin{itemize}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   231
\item sequencing
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   232
\item alternative
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   233
\item semantic action
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   234
\end{itemize}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   235
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   236
\end{frame}}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   237
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   238
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   239
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   240
\mode<presentation>{
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   241
\begin{frame}[c]
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   242
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   243
Alternative parser (code \bl{$p\;||\;q$})\bigskip
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   244
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   245
\begin{itemize}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   246
\item apply \bl{$p$} and also \bl{$q$}; then combine the outputs
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   247
\end{itemize}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   248
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   249
\begin{center}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   250
\large \bl{$p(\text{input}) \cup q(\text{input})$}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   251
\end{center}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   252
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   253
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   254
\end{frame}}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   255
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   256
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   257
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   258
\mode<presentation>{
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   259
\begin{frame}[c]
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   260
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   261
Sequence parser (code \bl{$p\sim q$})\bigskip
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   262
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   263
\begin{itemize}
70
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 69
diff changeset
   264
\item apply first \bl{$p$} producing a set of pairs
66
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   265
\item then apply \bl{$q$} to the unparsed parts
70
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 69
diff changeset
   266
\item then combine the results:\\ \mbox{}\;\;((output$_1$, output$_2$), unparsed part)
66
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   267
\end{itemize}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   268
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   269
\begin{center}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   270
\begin{tabular}{l}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   271
\large \bl{$\{((o_1, o_2), u_2) \;|\;$}\\[2mm] 
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   272
\large\mbox{}\hspace{15mm} \bl{$(o_1, u_1) \in p(\text{input}) \wedge$}\\[2mm]
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   273
\large\mbox{}\hspace{15mm} \bl{$(o_2, u_2) \in q(u_1)\}$}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   274
\end{tabular}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   275
\end{center}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   276
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   277
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   278
\end{frame}}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   279
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   280
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   281
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   282
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   283
\mode<presentation>{
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   284
\begin{frame}[c]
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   285
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   286
Function parser (code \bl{$p \Longrightarrow f$})\bigskip
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   287
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   288
\begin{itemize}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   289
\item apply \bl{$p$} producing a set of pairs
70
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 69
diff changeset
   290
\item then apply the function \bl{$f$} to each first component
66
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   291
\end{itemize}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   292
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   293
\begin{center}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   294
\begin{tabular}{l}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   295
\large \bl{$\{(f(o_1), u_1) \;|\; (o_1, u_1) \in p(\text{input})\}$}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   296
\end{tabular}
70
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 69
diff changeset
   297
\end{center}\bigskip\bigskip\pause
66
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   298
70
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 69
diff changeset
   299
\bl{$f$} is the semantic action (``what to do with the parsed input'')
66
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   300
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   301
\end{frame}}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   302
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   303
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   304
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   305
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   306
\mode<presentation>{
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   307
\begin{frame}[c]
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   308
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   309
Token parser:\bigskip
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   310
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   311
\begin{itemize}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   312
\item if the input is
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   313
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   314
\begin{center}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   315
\large \bl{$tok_1:: tok_2 :: \ldots :: tok_n$}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   316
\end{center}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   317
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   318
then return
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   319
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   320
\begin{center}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   321
\large \bl{$\{(tok_1,\; tok_2 :: \ldots :: tok_n)\}$}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   322
\end{center}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   323
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   324
or
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   325
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   326
\begin{center}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   327
\large \bl{$\{\}$}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   328
\end{center}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   329
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   330
if \bl{$tok_1$} is not the right token we are looking for
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   331
\end{itemize}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   332
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   333
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   334
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   335
\end{frame}}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   336
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   337
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   338
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   339
\mode<presentation>{
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   340
\begin{frame}[c]
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   341
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   342
Number-Token parser:\bigskip
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   343
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   344
\begin{itemize}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   345
\item if the input is
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   346
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   347
\begin{center}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   348
\large \bl{$num\_tok(42):: tok_2 :: \ldots :: tok_n$}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   349
\end{center}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   350
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   351
then return
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   352
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   353
\begin{center}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   354
\large \bl{$\{(42,\; tok_2 :: \ldots :: tok_n)\}$}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   355
\end{center}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   356
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   357
or
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   358
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   359
\begin{center}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   360
\large \bl{$\{\}$}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   361
\end{center}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   362
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   363
if \bl{$tok_1$} is not the right token we are looking for
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   364
\end{itemize}\pause
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   365
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   366
\begin{center}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   367
list of tokens \bl{$\Rightarrow$} set of (\alert{int}, list of tokens)
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   368
\end{center}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   369
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   370
\end{frame}}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   371
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   372
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   373
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   374
\mode<presentation>{
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   375
\begin{frame}[c]
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   376
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   377
\begin{itemize}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   378
\item if the input is
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   379
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   380
\begin{center}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   381
\begin{tabular}{l}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   382
\large \bl{$num\_tok(42)::$}\\
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   383
\hspace{7mm}\large \bl{$num\_tok(3) ::$}\\
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   384
\hspace{14mm}\large \bl{$tok_3 :: \ldots :: tok_n$}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   385
\end{tabular}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   386
\end{center}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   387
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   388
and the parser is 
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   389
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   390
\begin{center}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   391
\bl{$ntp \sim ntp$}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   392
\end{center}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   393
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   394
the successful output will be
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   395
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   396
\begin{center}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   397
\large \bl{$\{((42, 3),\; tok_2 :: \ldots :: tok_n)\}$}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   398
\end{center}\pause
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   399
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   400
Now we can form
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   401
\begin{center}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   402
\bl{$(ntp \sim ntp) \Longrightarrow f$}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   403
\end{center}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   404
70
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 69
diff changeset
   405
where \bl{$f$} is the semantic action (``what to do with the pair'')
66
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   406
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   407
\end{itemize}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   408
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   409
\end{frame}}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   410
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   411
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   412
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   413
\mode<presentation>{
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   414
\begin{frame}[c]
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   415
\frametitle{\begin{tabular}{c}Semantic Actions\end{tabular}}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   416
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   417
Addition
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   418
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   419
\begin{center}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   420
\bl{$T \sim + \sim E \Longrightarrow \underbrace{f((x,y), z) \Rightarrow x + z}_{\text{semantic action}}$}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   421
\end{center}\pause
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   422
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   423
Multiplication
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   424
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   425
\begin{center}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   426
\bl{$F \sim * \sim T \Longrightarrow f((x,y), z) \Rightarrow x * z$}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   427
\end{center}\pause
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   428
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   429
Parenthesis
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   430
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   431
\begin{center}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   432
\bl{$\text{(} \sim E \sim \text{)} \Longrightarrow f((x,y), z) \Rightarrow y$}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   433
\end{center}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   434
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   435
\end{frame}}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   436
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   437
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   438
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   439
\mode<presentation>{
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   440
\begin{frame}[c]
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   441
\frametitle{\begin{tabular}{c}Types of Parsers\end{tabular}}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   442
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   443
\begin{itemize}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   444
\item {\bf Sequencing}: if \bl{$p$} returns results of type \bl{$T$}, and \bl{$q$} results of type \bl{$S$},
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   445
then \bl{$p \sim q$} returns results of type
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   446
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   447
\begin{center}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   448
\bl{$T \times S$}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   449
\end{center}\pause
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   450
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   451
\item {\bf Alternative}: if \bl{$p$} returns results of type \bl{$T$} then  \bl{$q$} \alert{must} also have results of type \bl{$T$},
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   452
and \bl{$p \;||\; q$} returns results of type
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   453
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   454
\begin{center}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   455
\bl{$T$}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   456
\end{center}\pause
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   457
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   458
\item {\bf Semantic Action}: if \bl{$p$} returns results of type \bl{$T$} and \bl{$f$} is a function from
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   459
\bl{$T$} to \bl{$S$}, then
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   460
\bl{$p \Longrightarrow f$} returns results of type
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   461
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   462
\begin{center}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   463
\bl{$S$}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   464
\end{center}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   465
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   466
\end{itemize}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   467
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   468
\end{frame}}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   469
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%  
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   470
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   471
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   472
\mode<presentation>{
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   473
\begin{frame}[c]
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   474
\frametitle{\begin{tabular}{c}Input Types of Parsers\end{tabular}}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   475
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   476
\begin{itemize}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   477
\item input: \alert{list of tokens}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   478
\item output: set of (output\_type, \alert{list of tokens})
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   479
\end{itemize}\bigskip\pause
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   480
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   481
actually it can be any input type as long as it is a kind of sequence
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   482
(for example a string)
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   483
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   484
\end{frame}}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   485
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%  
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   486
70
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 69
diff changeset
   487
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 69
diff changeset
   488
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 69
diff changeset
   489
\mode<presentation>{
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 69
diff changeset
   490
\begin{frame}[c]
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 69
diff changeset
   491
\frametitle{\begin{tabular}{c}Scannerless Parsers\end{tabular}}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 69
diff changeset
   492
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 69
diff changeset
   493
\begin{itemize}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 69
diff changeset
   494
\item input: \alert{string}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 69
diff changeset
   495
\item output: set of (output\_type, \alert{string})
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 69
diff changeset
   496
\end{itemize}\bigskip
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 69
diff changeset
   497
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 69
diff changeset
   498
but lexers are better when whitespaces or comments need to be filtered out
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 69
diff changeset
   499
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 69
diff changeset
   500
\end{frame}}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 69
diff changeset
   501
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%  
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 69
diff changeset
   502
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 69
diff changeset
   503
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 69
diff changeset
   504
\mode<presentation>{
77
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 76
diff changeset
   505
\begin{frame}[t]
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 76
diff changeset
   506
\frametitle{\begin{tabular}{c}Compiled vs.~Interpreted Code\end{tabular}}
65
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   507
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   508
\begin{center}
77
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 76
diff changeset
   509
\begin{tikzpicture}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 76
diff changeset
   510
\begin{axis}[axis x line=bottom, axis y line=left, xlabel=n, ylabel=mins]
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 76
diff changeset
   511
\addplot file {compiled.data};
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 76
diff changeset
   512
\end{axis}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 76
diff changeset
   513
\end{tikzpicture}
65
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   514
\end{center}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   515
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   516
\end{frame}}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   517
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   518
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   519
77
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 76
diff changeset
   520
65
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   521
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   522
\mode<presentation>{
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   523
\begin{frame}[t]
77
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 76
diff changeset
   524
\frametitle{\begin{tabular}{c}Compiled vs.~Interpreted Code\end{tabular}}
65
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   525
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   526
\mbox{}\\[-25mm]\mbox{}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   527
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   528
\begin{center}
77
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 76
diff changeset
   529
\begin{tikzpicture}[y=.4cm, x=.00000009cm]
65
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   530
 	%axis
77
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 76
diff changeset
   531
	\draw (0,0) -- coordinate (x axis mid) (5,0);
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 76
diff changeset
   532
    	\draw (0,0) -- coordinate (y axis mid) (0,5);
65
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   533
    	%ticks
77
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 76
diff changeset
   534
    	\foreach \x in {0, 1000,...,10000}
65
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   535
     		\draw (\x,1pt) -- (\x,-3pt)
77
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 76
diff changeset
   536
			node[anchor=north] {\small \x{}00};
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 76
diff changeset
   537
    	\foreach \y in {0,0.5,1, ..., 5.5}
65
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   538
     		\draw (1pt,\y) -- (-3pt,\y) 
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   539
     			node[anchor=east] {\small\y}; 
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   540
	%labels      
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   541
	\node[below=0.6cm] at (x axis mid) {\bl{1}s};
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   542
	\node[rotate=90, left=1.2cm] at (y axis mid) {secs};
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   543
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   544
	%plots
77
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 76
diff changeset
   545
	%\draw[color=blue] plot[mark=*, mark options={fill=white}] 
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 76
diff changeset
   546
	%	file {compiled.data};
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 76
diff changeset
   547
         %\only<2->{\draw[color=red] plot[mark=triangle*, mark options={fill=white} ] 
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 76
diff changeset
   548
          %        file {interpreted.data};}
65
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   549
	%legend
77
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 76
diff changeset
   550
	%\begin{scope}[shift={(400,20)}] 
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 76
diff changeset
   551
	%\draw[color=blue] (0,0) -- 
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 76
diff changeset
   552
	%	plot[mark=*, mark options={fill=white}] (0.25,0) -- (0.5,0) 
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 76
diff changeset
   553
	%	node[right]{\small unambiguous};
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 76
diff changeset
   554
	%\only<2->{\draw[yshift=\baselineskip, color=red] (0,0) -- 
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 76
diff changeset
   555
          %      plot[mark=triangle*, mark options={fill=white}] (0.25,0) -- (0.5,0)
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 76
diff changeset
   556
          %      node[right]{\small ambiguous};}  
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 76
diff changeset
   557
	%\end{scope}
65
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   558
\end{tikzpicture}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   559
\end{center}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   560
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   561
\end{frame}}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   562
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   563
69
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 67
diff changeset
   564
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 67
diff changeset
   565
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 67
diff changeset
   566
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 67
diff changeset
   567
65
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   568
\end{document}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   569
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   570
%%% Local Variables:  
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   571
%%% mode: latex
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   572
%%% TeX-master: t
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   573
%%% End: 
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   574