slides/slides09.tex
author Christian Urban <christian dot urban at kcl dot ac dot uk>
Sat, 30 Nov 2013 00:06:02 +0000
changeset 214 5be68de225e9
parent 207 f824e1331fc6
child 215 828303e8e4af
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}
206
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
     2
\usepackage{beamerthemeplaincu}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
     3
%\usepackage[T1]{fontenc}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
     4
%\usepackage[latin1]{inputenc}
65
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}
207
f824e1331fc6 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
    24
\setmonofont{Consolas}
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}{
84
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
    78
  morekeywords={if,then,else,while,do,true,false,write},
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
    79
  otherkeywords={=,!=,:=,<,>,;},
77
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}
207
f824e1331fc6 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
    98
	
77
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 
206
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   101
\renewcommand{\slidecaption}{AFL 09, King's College London, 27.~November 2013}
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
206
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   105
 \pgfdeclareradialshading{smallbluesphere}{\pgfpoint{0.5mm}{0.5mm}}%
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   106
  {rgb(0mm)=(0,0,0.9);
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   107
  rgb(0.9mm)=(0,0,0.7);
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   108
  rgb(1.3mm)=(0,0,0.5);
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   109
  rgb(1.4mm)=(1,1,1)}
65
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   110
206
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   111
  \def\myitemi{\begin{pgfpicture}{-1ex}{-0.55ex}{1ex}{1ex}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   112
    \usebeamercolor[fg]{subitem projected}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   113
    {\pgftransformscale{0.8}\pgftext{\normalsize\pgfuseshading{bigsphere}}}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   114
    \pgftext{%
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   115
      \usebeamerfont*{subitem projected}}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   116
  \end{pgfpicture}}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   117
  
65
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   118
% The data files, written on the first run.
77
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 76
diff changeset
   119
\begin{filecontents}{compiled.data}
80
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 79
diff changeset
   120
%1 0.234146
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 79
diff changeset
   121
%5000 0.227539
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 79
diff changeset
   122
%10000 0.280748
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 79
diff changeset
   123
50000 1.087897
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 79
diff changeset
   124
100000 3.713165
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 79
diff changeset
   125
250000 21.6624545
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 79
diff changeset
   126
500000 85.872613
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 79
diff changeset
   127
750000 203.6408015
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 79
diff changeset
   128
1000000 345.736574
65
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   129
\end{filecontents}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   130
77
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 76
diff changeset
   131
\begin{filecontents}{interpreted.data}
80
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 79
diff changeset
   132
%1 0.00503
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 79
diff changeset
   133
200 1.005863
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 79
diff changeset
   134
400 7.8296765
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 79
diff changeset
   135
500 15.43106
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 79
diff changeset
   136
600 27.2321885
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 79
diff changeset
   137
800 65.249271
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 79
diff changeset
   138
1000 135.4493445
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 79
diff changeset
   139
1200 232.134097
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 79
diff changeset
   140
1400 382.527227
65
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   141
\end{filecontents}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   142
81
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 80
diff changeset
   143
\begin{filecontents}{interpreted2.data}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 80
diff changeset
   144
%1 0.00503
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 80
diff changeset
   145
200 1.005863
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 80
diff changeset
   146
400 7.8296765
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 80
diff changeset
   147
600 27.2321885
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 80
diff changeset
   148
800 65.249271
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 80
diff changeset
   149
1000 135.4493445
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 80
diff changeset
   150
1200 232.134097
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 80
diff changeset
   151
1400 382.527227
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 80
diff changeset
   152
\end{filecontents}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 80
diff changeset
   153
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 80
diff changeset
   154
\begin{filecontents}{compiled2.data}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 80
diff changeset
   155
200 0.222058
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 80
diff changeset
   156
400 0.215204
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 80
diff changeset
   157
600 0.202031
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 80
diff changeset
   158
800 0.21986
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 80
diff changeset
   159
1000 0.205934
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 80
diff changeset
   160
1200 0.1981615
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 80
diff changeset
   161
1400 0.207116
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 80
diff changeset
   162
\end{filecontents}
65
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   163
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   164
\begin{document}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   165
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   166
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   167
\mode<presentation>{
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   168
\begin{frame}<1>[t]
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   169
\frametitle{%
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   170
  \begin{tabular}{@ {}c@ {}}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   171
  \\[-3mm]
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   172
  \LARGE Automata and \\[-2mm] 
76
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 70
diff changeset
   173
  \LARGE Formal Languages (9)\\[3mm] 
65
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   174
  \end{tabular}}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   175
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   176
  \normalsize
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   177
  \begin{center}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   178
  \begin{tabular}{ll}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   179
  Email:  & christian.urban at kcl.ac.uk\\
206
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   180
  Office: & S1.27 (1st floor Strand Building)\\
65
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   181
  Slides: & KEATS (also home work is there)\\
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   182
  \end{tabular}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   183
  \end{center}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   184
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   185
\end{frame}}
77
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 76
diff changeset
   186
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%     
65
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   187
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   188
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   189
\mode<presentation>{
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   190
\begin{frame}[c]
80
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 79
diff changeset
   191
206
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   192
\large\bf
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   193
Using a compiler, \\how can you mount the\\ perfect attack against a system?
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   194
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   195
\end{frame}}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   196
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   197
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   198
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   199
\mode<presentation>{
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   200
\begin{frame}[c]
80
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 79
diff changeset
   201
206
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   202
{\large\bf
207
f824e1331fc6 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   203
What is a \alert{perfect} attack?}\bigskip
206
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   204
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   205
\begin{enumerate}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   206
\item you can potentially completely take over a target system
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   207
\item your attack is (nearly) undetectable
207
f824e1331fc6 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   208
\item the victim has (almost) no chance to recover
206
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   209
\end{enumerate}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   210
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   211
\end{frame}}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   212
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
80
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 79
diff changeset
   213
206
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   214
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   215
\mode<presentation>{
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   216
\begin{frame}[c]
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   217
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   218
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   219
  \begin{center}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   220
  \begin{tikzpicture}[scale=1]
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   221
  
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   222
  \onslide<1->{
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   223
  \node (A) at (0,0)  [draw=black, rectangle, very thick, minimum height=18mm, minimum width=17mm] {};
207
f824e1331fc6 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   224
  \node [below right] at (A.north west) {\footnotesize\begin{tabular}{@{}l@{}}
f824e1331fc6 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   225
  \only<1,2>{clean}\only<3->{\alert{hacked}}\\compiler\end{tabular}};}
206
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   226
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   227
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   228
  \onslide<2->{
207
f824e1331fc6 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   229
  \node (B) at (-2,2)  [draw=black, rectangle, very thick, minimum height=10mm, minimum width=12mm] {};
f824e1331fc6 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   230
  \node [below right] at (B.north west) {\footnotesize\begin{tabular}{@{}l@{}}login\\(src)\end{tabular}};
f824e1331fc6 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   231
  
f824e1331fc6 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   232
  \node (C) at (2,2)  [draw=black, rectangle, very thick, minimum height=10mm, minimum width=12mm] {};
f824e1331fc6 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   233
  \node [below right] at (C.north west) {\footnotesize\begin{tabular}{@{}l@{}}login\\(bin)\end{tabular}};
f824e1331fc6 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   234
f824e1331fc6 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   235
  \draw[->, line width=2mm] (B) -- (C);
206
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   236
  }
207
f824e1331fc6 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   237
  
f824e1331fc6 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   238
 \onslide<3->{\node [above left=-1.5mm] at (C.south east) {\footnotesize \alert{$\blacksquare$}};}
206
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   239
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   240
  \end{tikzpicture}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   241
  \end{center}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   242
80
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 79
diff changeset
   243
\end{frame}}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 79
diff changeset
   244
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 79
diff changeset
   245
206
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   246
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   247
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   248
\mode<presentation>{
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   249
\begin{frame}[c]
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   250
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   251
  \begin{center}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   252
  \begin{tikzpicture}[scale=1]
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   253
  
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   254
  \onslide<1->{
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   255
  \node (A) at (0,0)  [draw=black, rectangle, very thick, minimum height=18mm, minimum width=14mm] {};
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   256
  \node [below right] at (A.north west) {\small V0.01};
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   257
  \node [below right] (A1) at (A.south west) {\small Scala};
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   258
  \node [below right] (A1) at (A1.south west) {\small\textcolor{gray}{host language}};
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   259
  \node [above right] at (A.north west) {my compiler (src)};}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   260
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   261
  \onslide<2->{
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   262
  \node (B) at (1.8,0)  [draw=black, rectangle, very thick, minimum height=18mm, minimum width=14mm] {};
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   263
  \node [below right] at (B.north west) {\small V0.02};
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   264
  \node [below right] at (B.south west) {\small Scala};
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   265
  \node at (3,0) {\ldots};
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   266
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   267
  \node (C) at (5,0)  [draw=black, rectangle, very thick, minimum height=18mm, minimum width=14mm] {};
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   268
  \node [below right] at (C.north west) {\small V1.00};
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   269
  \node [below right] at (C.south west) {\small Scala};}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   270
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   271
  \onslide<3->{
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   272
  \node (D) at (6.8,0)  [draw=black, rectangle, very thick, minimum height=18mm, minimum width=14mm] {};
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   273
  \node [below right] at (D.north west) {\small V1.00};
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   274
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   275
  \node (E) at (6.8,2)  [draw=black, rectangle, very thick, minimum height=18mm, minimum width=14mm] {};
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   276
  \node [below right] at (E.north west) {\small V1.01};}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   277
  
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   278
  \onslide<4->{
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   279
  \node (F) at (8.6,0)  [draw=black, rectangle, very thick, minimum height=18mm, minimum width=14mm] {};
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   280
  \node [below right] at (F.north west) {\small V1.01};
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   281
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   282
  \node (G) at (8.6,2)  [draw=black, rectangle, very thick, minimum height=18mm, minimum width=14mm] {};
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   283
  \node [below right] at (G.north west) {\small V1.02};
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   284
  \node at (9.8,0) {\ldots};
207
f824e1331fc6 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   285
  \node at (9.8,2) {\ldots};
f824e1331fc6 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   286
  \node at (8,-2) {\textcolor{gray}{\begin{tabular}{@{}l@{}}no host language\\needed\end{tabular}}};
f824e1331fc6 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   287
  }
206
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   288
  
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   289
  \end{tikzpicture}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   290
  \end{center}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   291
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   292
\end{frame}}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   293
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   294
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   295
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   296
  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   297
  \mode<presentation>{
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   298
  \begin{frame}<1-3>
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   299
  \frametitle{\LARGE\begin{tabular}{c}Hacking Compilers 
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   300
  \end{tabular}}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   301
  
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   302
  %Why is it so paramount to have a small trusted code base (TCB)?
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   303
  \bigskip\bigskip
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   304
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   305
  \begin{columns}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   306
  \begin{column}{2.7cm}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   307
  \begin{minipage}{2.5cm}%
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   308
  \begin{tabular}{c@ {}}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   309
  \includegraphics[scale=0.2]{../pics/ken-thompson.jpg}\\[-1.8mm]
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   310
  \footnotesize Ken Thompson\\[-1.8mm]
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   311
  \footnotesize Turing Award, 1983\\
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   312
  \end{tabular}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   313
  \end{minipage}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   314
  \end{column}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   315
  \begin{column}{9cm}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   316
  \begin{tabular}{l@ {\hspace{1mm}}p{8cm}}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   317
  \myitemi
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   318
  & Ken Thompson showed how to hide a Trojan Horse in a 
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   319
  compiler \textcolor{red}{without} leaving any traces in the source code.\\[2mm]
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   320
  \myitemi
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   321
  & No amount of source level verification will protect 
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   322
  you from such Thompson-hacks.\\[2mm]
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   323
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   324
  \myitemi
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   325
  & Therefore in safety-critical systems it is important to rely 
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   326
  on only a very small TCB.
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   327
  \end{tabular}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   328
  \end{column}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   329
  \end{columns}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   330
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   331
  \only<2>{
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   332
  \begin{textblock}{6}(4,2)
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   333
  \begin{tikzpicture}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   334
  \draw (0,0) node[inner sep=3mm,fill=cream, ultra thick, draw=red, rounded corners=2mm] 
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   335
  {\normalsize
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   336
  \begin{minipage}{8cm}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   337
  \begin{quote}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   338
  \includegraphics[scale=0.05]{../pics/evil.png}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   339
  \begin{enumerate}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   340
  \item[1)] Assume you ship the compiler as binary and also with sources.
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   341
  \item[2)] Make the compiler aware when it compiles itself.
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   342
  \item[3)] Add the Trojan horse.
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   343
  \item[4)] Compile.
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   344
  \item[5)] Delete Trojan horse from the sources of the compiler.
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   345
  \item[6)] Go on holiday for the rest of your life. ;o)\\[-7mm]\mbox{}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   346
  \end{enumerate}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   347
  \end{quote}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   348
  \end{minipage}};
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   349
  \end{tikzpicture}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   350
  \end{textblock}}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   351
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   352
  \end{frame}}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   353
  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%     
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   354
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   355
80
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 79
diff changeset
   356
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 79
diff changeset
   357
\mode<presentation>{
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 79
diff changeset
   358
\begin{frame}[c]
207
f824e1331fc6 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   359
\frametitle{Our Compiler}
f824e1331fc6 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   360
f824e1331fc6 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   361
  \begin{center}
f824e1331fc6 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   362
  \begin{tikzpicture}[scale=1]
f824e1331fc6 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   363
f824e1331fc6 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   364
  \node (0) at (-2.3,0) {}; 
f824e1331fc6 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   365
  
f824e1331fc6 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   366
  \node (A) at (0,0)  [draw=black, rectangle, very thick, minimum height=18mm, minimum width=20mm] {};
f824e1331fc6 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   367
  \node [below right] at (A.north west) {lexer};
f824e1331fc6 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   368
f824e1331fc6 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   369
  \node (B) at (3,0)  [draw=black, rectangle, very thick, minimum height=18mm, minimum width=20mm] {};
f824e1331fc6 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   370
  \node [below right=1mm] at (B.north west) {\mbox{}\hspace{-1mm}parser};
f824e1331fc6 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   371
f824e1331fc6 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   372
  \node (C) at (6,0)  [draw=black, rectangle, very thick, minimum height=18mm, minimum width=20mm] {};
f824e1331fc6 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   373
  \node [below right] at (C.north west) {\mbox{}\hspace{-1mm}code gen};
f824e1331fc6 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   374
f824e1331fc6 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   375
  \node (1) at (8.4,0) {}; 
f824e1331fc6 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   376
f824e1331fc6 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   377
  \draw [->,line width=4mm] (0) -- (A); 
f824e1331fc6 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   378
  \draw [->,line width=4mm] (A) -- (B); 
f824e1331fc6 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   379
  \draw [->,line width=4mm] (B) -- (C); 
f824e1331fc6 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   380
  \draw [->,line width=4mm] (C) -- (1); 
f824e1331fc6 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   381
  \end{tikzpicture}
f824e1331fc6 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   382
  \end{center}
f824e1331fc6 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   383
f824e1331fc6 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   384
lexer input: string\medskip\\
f824e1331fc6 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   385
lexer output: sequence of tokens\\ 
f824e1331fc6 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   386
\mbox{}\hfill(white space and comments filtered out)\medskip\\
f824e1331fc6 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   387
parser output: abstract syntax tree\medskip\\ 
f824e1331fc6 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   388
code gen output: assembler byte code / \\
f824e1331fc6 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   389
\mbox{}\hfill assembler machine code
f824e1331fc6 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   390
\end{frame}}
f824e1331fc6 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   391
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
f824e1331fc6 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   392
f824e1331fc6 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   393
f824e1331fc6 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   394
f824e1331fc6 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   395
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
f824e1331fc6 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   396
\mode<presentation>{
f824e1331fc6 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   397
\begin{frame}[c]
f824e1331fc6 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   398
\frametitle{\begin{tabular}{c}For-Loops\end{tabular}}
f824e1331fc6 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   399
f824e1331fc6 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   400
f824e1331fc6 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   401
\begin{center}\Large
f824e1331fc6 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   402
\texttt{for} \;\textit{Id} \texttt{:=} \textit{AExp}\; \texttt{upto} \;\textit{AExp}\; \texttt{do} \textit{Block}
f824e1331fc6 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   403
\end{center}\bigskip
f824e1331fc6 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   404
f824e1331fc6 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   405
\begin{center}
f824e1331fc6 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   406
\begin{minipage}{8cm}
f824e1331fc6 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   407
\begin{tabular}{l}
f824e1331fc6 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   408
\texttt{for i := 2 upto 4 do \{}\\
f824e1331fc6 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   409
\hspace{5mm}\texttt{write i}\\	
f824e1331fc6 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   410
\texttt{\}}\
f824e1331fc6 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   411
\end{tabular}
f824e1331fc6 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   412
\end{minipage}
f824e1331fc6 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   413
\end{center}
f824e1331fc6 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   414
\end{frame}}
f824e1331fc6 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   415
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
f824e1331fc6 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   416
f824e1331fc6 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   417
f824e1331fc6 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   418
f824e1331fc6 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   419
f824e1331fc6 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   420
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
f824e1331fc6 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   421
\mode<presentation>{
f824e1331fc6 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   422
\begin{frame}[c]
77
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 76
diff changeset
   423
\frametitle{\begin{tabular}{c}While-Language\end{tabular}}
66
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
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   426
\begin{center}
77
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 76
diff changeset
   427
\bl{\begin{tabular}{@{}lcl@{}}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 76
diff changeset
   428
$Stmt$ & $\rightarrow$ &  $\text{skip}$\\
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 76
diff changeset
   429
              & $|$ & $Id := AExp$\\
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 76
diff changeset
   430
              & $|$ & $\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
   431
              & $|$ & $\text{while}\; B\!Exp \;\text{do}\; Block$\\
207
f824e1331fc6 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   432
               & $|$ & $\alert{\text{write}\; Id}$\\
f824e1331fc6 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   433
                & $|$ & $\alert{\text{read}\; Id}$\medskip\\
77
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 76
diff changeset
   434
$Stmts$ & $\rightarrow$ &  $Stmt \;\text{;}\; Stmts$\\
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 76
diff changeset
   435
              & $|$ & $Stmt$\medskip\\
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 76
diff changeset
   436
$Block$ & $\rightarrow$ &  $\{ Stmts \}$\\
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 76
diff changeset
   437
                & $|$ & $Stmt$\medskip\\
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 76
diff changeset
   438
$AExp$ & $\rightarrow$ & \ldots\\
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 76
diff changeset
   439
$BExp$ & $\rightarrow$ & \ldots\\
66
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   440
\end{tabular}}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   441
\end{center}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   442
77
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 76
diff changeset
   443
66
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   444
\end{frame}}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   445
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   446
77
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 76
diff changeset
   447
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 76
diff changeset
   448
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 76
diff changeset
   449
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 76
diff changeset
   450
\mode<presentation>{
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 76
diff changeset
   451
\begin{frame}[c]
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 76
diff changeset
   452
\frametitle{\begin{tabular}{c}Interpreter\end{tabular}}
66
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   453
80
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 79
diff changeset
   454
\begin{center}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 79
diff changeset
   455
\bl{\begin{tabular}{@{}lcl@{}}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 79
diff changeset
   456
$\text{eval}(n, E)$ & $\dn$ & $n$\\
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 79
diff changeset
   457
$\text{eval}(x, E)$ & $\dn$ & $E(x)$ \;\;\;\textcolor{black}{lookup \bl{$x$} in \bl{$E$}}\\
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 79
diff changeset
   458
$\text{eval}(a_1 + a_2, E)$ & $\dn$ & $\text{eval}(a_1, E) + \text{eval}(a_2, E)$\\
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 79
diff changeset
   459
$\text{eval}(a_1 - a_2, E)$ & $\dn$ & $\text{eval}(a_1, E) - \text{eval}(a_2, E)$\\
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 79
diff changeset
   460
$\text{eval}(a_1 * a_2, E)$ & $\dn$ & $\text{eval}(a_1, E) * \text{eval}(a_2, E)$\bigskip\\
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 79
diff changeset
   461
$\text{eval}(a_1 = a_2, E)$ & $\dn$ & $\text{eval}(a_1, E) = \text{eval}(a_2, E)$\\
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 79
diff changeset
   462
$\text{eval}(a_1\,!\!= a_2, E)$ & $\dn$ & $\neg(\text{eval}(a_1, E) = \text{eval}(a_2, E))$\\
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 79
diff changeset
   463
$\text{eval}(a_1 < a_2, E)$ & $\dn$ & $\text{eval}(a_1, E) < \text{eval}(a_2, E)$\
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 79
diff changeset
   464
\end{tabular}}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 79
diff changeset
   465
\end{center}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 79
diff changeset
   466
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 79
diff changeset
   467
\end{frame}}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 79
diff changeset
   468
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 79
diff changeset
   469
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 79
diff changeset
   470
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 79
diff changeset
   471
\mode<presentation>{
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 79
diff changeset
   472
\begin{frame}[c]
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 79
diff changeset
   473
\frametitle{\begin{tabular}{c}Interpreter (2)\end{tabular}}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 79
diff changeset
   474
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 79
diff changeset
   475
\begin{center}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 79
diff changeset
   476
\bl{\begin{tabular}{@{}lcl@{}}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 79
diff changeset
   477
$\text{eval}(\text{skip}, E)$ & $\dn$ & $E$\\
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 79
diff changeset
   478
$\text{eval}(x:=a, E)$ & $\dn$ & \bl{$E(x \mapsto \text{eval}(a, E))$}\\
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 79
diff changeset
   479
\multicolumn{3}{@{}l@{}}{$\text{eval}(\text{if}\;b\;\text{then}\;cs_1\;\text{else}\;cs_2 , E) \dn$}\\
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 79
diff changeset
   480
\multicolumn{3}{@{}l@{}}{\hspace{2cm}$\text{if}\;\text{eval}(b,E)\;\text{then}\;
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 79
diff changeset
   481
\text{eval}(cs_1,E)$}\\
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 79
diff changeset
   482
\multicolumn{3}{@{}l@{}}{\hspace{2cm}$\phantom{\text{if}\;\text{eval}(b,E)\;}\text{else}\;\text{eval}(cs_2,E)$}\\
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 79
diff changeset
   483
\multicolumn{3}{@{}l@{}}{$\text{eval}(\text{while}\;b\;\text{do}\;cs, E) \dn$}\\
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 79
diff changeset
   484
\multicolumn{3}{@{}l@{}}{\hspace{2cm}$\text{if}\;\text{eval}(b,E)$}\\
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 79
diff changeset
   485
\multicolumn{3}{@{}l@{}}{\hspace{2cm}$\text{then}\;
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 79
diff changeset
   486
\text{eval}(\text{while}\;b\;\text{do}\;cs, \text{eval}(cs,E))$}\\
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 79
diff changeset
   487
\multicolumn{3}{@{}l@{}}{\hspace{2cm}$\text{else}\; E$}\\
81
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 80
diff changeset
   488
$\text{eval}(\text{write}\; x, E)$ & $\dn$ & $\{\;\text{println}(E(x))\; ;\;E\;\}$\\
80
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 79
diff changeset
   489
\end{tabular}}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 79
diff changeset
   490
\end{center}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 79
diff changeset
   491
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 79
diff changeset
   492
\end{frame}}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 79
diff changeset
   493
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 79
diff changeset
   494
207
f824e1331fc6 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   495
 
80
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 79
diff changeset
   496
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 79
diff changeset
   497
\mode<presentation>{
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 79
diff changeset
   498
\begin{frame}[t]
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 79
diff changeset
   499
\frametitle{\begin{tabular}{c}Compiling Writes\end{tabular}}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 79
diff changeset
   500
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 79
diff changeset
   501
{\Large\bl{write $x$}}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 79
diff changeset
   502
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 79
diff changeset
   503
\begin{center}
81
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 80
diff changeset
   504
\small\bl{\begin{tabular}{l}
84
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   505
.method public static write(I)V\hspace{1cm}\textcolor{black}{(library function)}\\ 
81
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 80
diff changeset
   506
\;\;    .limit locals 5 \\
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 80
diff changeset
   507
\;\;    .limit stack 5 \\
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 80
diff changeset
   508
\;\;    iload 0 \\
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 80
diff changeset
   509
\;\;    getstatic java/lang/System/out Ljava/io/PrintStream;\\ 
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 80
diff changeset
   510
\;\;    swap \\
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 80
diff changeset
   511
\;\;    invokevirtual java/io/PrintStream/println(I)V \\
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 80
diff changeset
   512
\;\;    return \\
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 80
diff changeset
   513
.end method\bigskip\bigskip\\
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 80
diff changeset
   514
%
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 80
diff changeset
   515
\normalsize
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 80
diff changeset
   516
iload $E(x)$\\
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 80
diff changeset
   517
invokestatic write(I)V\\
80
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 79
diff changeset
   518
\end{tabular}}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 79
diff changeset
   519
\end{center}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 79
diff changeset
   520
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 79
diff changeset
   521
\end{frame}}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 79
diff changeset
   522
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
82
06c3ec0b452e updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 81
diff changeset
   523
06c3ec0b452e updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 81
diff changeset
   524
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
06c3ec0b452e updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 81
diff changeset
   525
\mode<presentation>{
06c3ec0b452e updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 81
diff changeset
   526
\begin{frame}[c]
06c3ec0b452e updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 81
diff changeset
   527
06c3ec0b452e updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 81
diff changeset
   528
\begin{center}
06c3ec0b452e updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 81
diff changeset
   529
\small\bl{\begin{tabular}{l}
06c3ec0b452e updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 81
diff changeset
   530
.class public XXX.XXX\\
06c3ec0b452e updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 81
diff changeset
   531
.super java/lang/Object\\
06c3ec0b452e updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 81
diff changeset
   532
\\
06c3ec0b452e updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 81
diff changeset
   533
.method public <init>()V\\
06c3ec0b452e updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 81
diff changeset
   534
\;\;     aload\_0\\
06c3ec0b452e updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 81
diff changeset
   535
\;\;     invokenonvirtual java/lang/Object/<init>()V\\
06c3ec0b452e updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 81
diff changeset
   536
 \;\;    return\\
06c3ec0b452e updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 81
diff changeset
   537
.end method\\
06c3ec0b452e updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 81
diff changeset
   538
\\
06c3ec0b452e updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 81
diff changeset
   539
.method public static main([Ljava/lang/String;)V\\
06c3ec0b452e updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 81
diff changeset
   540
\;\;   .limit locals 200\\
06c3ec0b452e updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 81
diff changeset
   541
\;\;     .limit stack 200\\
06c3ec0b452e updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 81
diff changeset
   542
\\
06c3ec0b452e updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 81
diff changeset
   543
   \textcolor{black}{(here comes the compiled code)}\\
06c3ec0b452e updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 81
diff changeset
   544
\\
06c3ec0b452e updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 81
diff changeset
   545
\;\;     return\\
06c3ec0b452e updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 81
diff changeset
   546
.end method\\
06c3ec0b452e updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 81
diff changeset
   547
\end{tabular}}
06c3ec0b452e updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 81
diff changeset
   548
\end{center}
06c3ec0b452e updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 81
diff changeset
   549
06c3ec0b452e updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 81
diff changeset
   550
\end{frame}}
06c3ec0b452e updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 81
diff changeset
   551
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%  
06c3ec0b452e updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 81
diff changeset
   552
65
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   553
\end{document}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   554
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   555
%%% Local Variables:  
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   556
%%% mode: latex
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   557
%%% TeX-master: t
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   558
%%% End: 
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   559