slides/slides09.tex
author Christian Urban <christian dot urban at kcl dot ac dot uk>
Sun, 23 Nov 2014 22:12:18 +0000
changeset 309 640e4a05cd9b
parent 215 828303e8e4af
child 310 d384fe01d0e8
permissions -rw-r--r--
updated
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}
309
640e4a05cd9b updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 215
diff changeset
     2
\usepackage{../slides}
215
828303e8e4af updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 207
diff changeset
     3
\usepackage{../langs}
828303e8e4af updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 207
diff changeset
     4
\usepackage{../data}
309
640e4a05cd9b updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 215
diff changeset
     5
\usepackage{../graphics}
65
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
     6
77
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 76
diff changeset
     7
65
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
     8
% beamer stuff 
309
640e4a05cd9b updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 215
diff changeset
     9
\renewcommand{\slidecaption}{AFL 09, King's College London}
65
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    10
\newcommand{\bl}[1]{\textcolor{blue}{#1}}       
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    11
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    12
\begin{document}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    13
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    14
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
309
640e4a05cd9b updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 215
diff changeset
    15
\begin{frame}[t]
65
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    16
\frametitle{%
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    17
  \begin{tabular}{@ {}c@ {}}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    18
  \\[-3mm]
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    19
  \LARGE Automata and \\[-2mm] 
76
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 70
diff changeset
    20
  \LARGE Formal Languages (9)\\[3mm] 
65
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    21
  \end{tabular}}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    22
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    23
  \normalsize
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    24
  \begin{center}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    25
  \begin{tabular}{ll}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    26
  Email:  & christian.urban at kcl.ac.uk\\
206
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
    27
  Office: & S1.27 (1st floor Strand Building)\\
65
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    28
  Slides: & KEATS (also home work is there)\\
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    29
  \end{tabular}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    30
  \end{center}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    31
309
640e4a05cd9b updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 215
diff changeset
    32
\end{frame}
77
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 76
diff changeset
    33
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%     
65
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    34
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    35
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    36
\mode<presentation>{
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    37
\begin{frame}[c]
80
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 79
diff changeset
    38
206
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
    39
\large\bf
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
    40
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
    41
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
    42
\end{frame}}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
    43
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
    44
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
    45
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
    46
\mode<presentation>{
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
    47
\begin{frame}[c]
80
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 79
diff changeset
    48
206
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
    49
{\large\bf
207
f824e1331fc6 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
    50
What is a \alert{perfect} attack?}\bigskip
206
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
    51
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
    52
\begin{enumerate}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
    53
\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
    54
\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
    55
\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
    56
\end{enumerate}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
    57
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
    58
\end{frame}}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
    59
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
80
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 79
diff changeset
    60
206
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
    61
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
    62
\mode<presentation>{
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
    63
\begin{frame}[c]
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
    64
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
    65
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
    66
  \begin{center}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
    67
  \begin{tikzpicture}[scale=1]
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
    68
  
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
    69
  \onslide<1->{
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
    70
  \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
    71
  \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
    72
  \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
    73
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
    74
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
    75
  \onslide<2->{
207
f824e1331fc6 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
    76
  \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
    77
  \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
    78
  
f824e1331fc6 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
    79
  \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
    80
  \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
    81
f824e1331fc6 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
    82
  \draw[->, line width=2mm] (B) -- (C);
206
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
    83
  }
207
f824e1331fc6 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
    84
  
f824e1331fc6 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
    85
 \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
    86
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
    87
  \end{tikzpicture}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
    88
  \end{center}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
    89
80
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 79
diff changeset
    90
\end{frame}}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 79
diff changeset
    91
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 79
diff changeset
    92
206
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
    93
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
    94
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
    95
\mode<presentation>{
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
    96
\begin{frame}[c]
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
    97
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
    98
  \begin{center}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
    99
  \begin{tikzpicture}[scale=1]
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   100
  
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   101
  \onslide<1->{
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   102
  \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
   103
  \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
   104
  \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
   105
  \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
   106
  \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
   107
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   108
  \onslide<2->{
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   109
  \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
   110
  \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
   111
  \node [below right] at (B.south west) {\small Scala};
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   112
  \node at (3,0) {\ldots};
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   113
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   114
  \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
   115
  \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
   116
  \node [below right] at (C.south west) {\small Scala};}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   117
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   118
  \onslide<3->{
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   119
  \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
   120
  \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
   121
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   122
  \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
   123
  \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
   124
  
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   125
  \onslide<4->{
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   126
  \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
   127
  \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
   128
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   129
  \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
   130
  \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
   131
  \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
   132
  \node at (9.8,2) {\ldots};
f824e1331fc6 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   133
  \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
   134
  }
206
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   135
  
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   136
  \end{tikzpicture}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   137
  \end{center}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   138
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   139
\end{frame}}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   140
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   141
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   142
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   143
  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   144
  \mode<presentation>{
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   145
  \begin{frame}<1-3>
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   146
  \frametitle{\LARGE\begin{tabular}{c}Hacking Compilers 
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   147
  \end{tabular}}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   148
  
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   149
  %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
   150
  \bigskip\bigskip
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   151
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   152
  \begin{columns}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   153
  \begin{column}{2.7cm}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   154
  \begin{minipage}{2.5cm}%
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   155
  \begin{tabular}{c@ {}}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   156
  \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
   157
  \footnotesize Ken Thompson\\[-1.8mm]
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   158
  \footnotesize Turing Award, 1983\\
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   159
  \end{tabular}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   160
  \end{minipage}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   161
  \end{column}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   162
  \begin{column}{9cm}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   163
  \begin{tabular}{l@ {\hspace{1mm}}p{8cm}}
309
640e4a05cd9b updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 215
diff changeset
   164
 
206
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   165
  & 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
   166
  compiler \textcolor{red}{without} leaving any traces in the source code.\\[2mm]
309
640e4a05cd9b updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 215
diff changeset
   167
  
206
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   168
  & No amount of source level verification will protect 
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   169
  you from such Thompson-hacks.\\[2mm]
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   170
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   171
  & 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
   172
  on only a very small TCB.
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   173
  \end{tabular}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   174
  \end{column}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   175
  \end{columns}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   176
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   177
  \only<2>{
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   178
  \begin{textblock}{6}(4,2)
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   179
  \begin{tikzpicture}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   180
  \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
   181
  {\normalsize
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   182
  \begin{minipage}{8cm}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   183
  \begin{quote}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   184
  \includegraphics[scale=0.05]{../pics/evil.png}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   185
  \begin{enumerate}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   186
  \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
   187
  \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
   188
  \item[3)] Add the Trojan horse.
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   189
  \item[4)] Compile.
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   190
  \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
   191
  \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
   192
  \end{enumerate}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   193
  \end{quote}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   194
  \end{minipage}};
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   195
  \end{tikzpicture}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   196
  \end{textblock}}
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
  \end{frame}}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   199
  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%     
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   200
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 151
diff changeset
   201
80
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 79
diff changeset
   202
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 79
diff changeset
   203
\mode<presentation>{
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 79
diff changeset
   204
\begin{frame}[c]
207
f824e1331fc6 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   205
\frametitle{Our Compiler}
f824e1331fc6 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   206
f824e1331fc6 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   207
  \begin{center}
f824e1331fc6 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   208
  \begin{tikzpicture}[scale=1]
f824e1331fc6 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   209
f824e1331fc6 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   210
  \node (0) at (-2.3,0) {}; 
f824e1331fc6 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   211
  
f824e1331fc6 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   212
  \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
   213
  \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
   214
f824e1331fc6 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   215
  \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
   216
  \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
   217
f824e1331fc6 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   218
  \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
   219
  \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
   220
f824e1331fc6 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   221
  \node (1) at (8.4,0) {}; 
f824e1331fc6 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   222
f824e1331fc6 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   223
  \draw [->,line width=4mm] (0) -- (A); 
f824e1331fc6 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   224
  \draw [->,line width=4mm] (A) -- (B); 
f824e1331fc6 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   225
  \draw [->,line width=4mm] (B) -- (C); 
f824e1331fc6 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   226
  \draw [->,line width=4mm] (C) -- (1); 
f824e1331fc6 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   227
  \end{tikzpicture}
f824e1331fc6 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   228
  \end{center}
f824e1331fc6 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   229
f824e1331fc6 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   230
lexer input: string\medskip\\
f824e1331fc6 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   231
lexer output: sequence of tokens\\ 
f824e1331fc6 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   232
\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
   233
parser output: abstract syntax tree\medskip\\ 
f824e1331fc6 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   234
code gen output: assembler byte code / \\
f824e1331fc6 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   235
\mbox{}\hfill assembler machine code
f824e1331fc6 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   236
\end{frame}}
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
f824e1331fc6 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   239
f824e1331fc6 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   240
f824e1331fc6 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   241
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
f824e1331fc6 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   242
\mode<presentation>{
f824e1331fc6 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   243
\begin{frame}[c]
f824e1331fc6 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   244
\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
   245
f824e1331fc6 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   246
f824e1331fc6 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   247
\begin{center}\Large
f824e1331fc6 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   248
\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
   249
\end{center}\bigskip
f824e1331fc6 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   250
f824e1331fc6 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   251
\begin{center}
f824e1331fc6 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   252
\begin{minipage}{8cm}
f824e1331fc6 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   253
\begin{tabular}{l}
f824e1331fc6 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   254
\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
   255
\hspace{5mm}\texttt{write i}\\	
f824e1331fc6 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   256
\texttt{\}}\
f824e1331fc6 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   257
\end{tabular}
f824e1331fc6 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   258
\end{minipage}
f824e1331fc6 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   259
\end{center}
f824e1331fc6 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   260
\end{frame}}
f824e1331fc6 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   261
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
f824e1331fc6 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   262
f824e1331fc6 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   263
f824e1331fc6 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   264
f824e1331fc6 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   265
f824e1331fc6 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   266
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
f824e1331fc6 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   267
\mode<presentation>{
f824e1331fc6 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   268
\begin{frame}[c]
77
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 76
diff changeset
   269
\frametitle{\begin{tabular}{c}While-Language\end{tabular}}
66
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   270
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   271
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   272
\begin{center}
77
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 76
diff changeset
   273
\bl{\begin{tabular}{@{}lcl@{}}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 76
diff changeset
   274
$Stmt$ & $\rightarrow$ &  $\text{skip}$\\
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 76
diff changeset
   275
              & $|$ & $Id := AExp$\\
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 76
diff changeset
   276
              & $|$ & $\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
   277
              & $|$ & $\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
   278
               & $|$ & $\alert{\text{write}\; Id}$\\
f824e1331fc6 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   279
                & $|$ & $\alert{\text{read}\; Id}$\medskip\\
77
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 76
diff changeset
   280
$Stmts$ & $\rightarrow$ &  $Stmt \;\text{;}\; Stmts$\\
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 76
diff changeset
   281
              & $|$ & $Stmt$\medskip\\
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 76
diff changeset
   282
$Block$ & $\rightarrow$ &  $\{ Stmts \}$\\
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 76
diff changeset
   283
                & $|$ & $Stmt$\medskip\\
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 76
diff changeset
   284
$AExp$ & $\rightarrow$ & \ldots\\
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 76
diff changeset
   285
$BExp$ & $\rightarrow$ & \ldots\\
66
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   286
\end{tabular}}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   287
\end{center}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   288
77
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 76
diff changeset
   289
66
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   290
\end{frame}}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   291
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   292
77
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 76
diff changeset
   293
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 76
diff changeset
   294
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 76
diff changeset
   295
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 76
diff changeset
   296
\mode<presentation>{
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 76
diff changeset
   297
\begin{frame}[c]
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 76
diff changeset
   298
\frametitle{\begin{tabular}{c}Interpreter\end{tabular}}
66
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
   299
80
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 79
diff changeset
   300
\begin{center}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 79
diff changeset
   301
\bl{\begin{tabular}{@{}lcl@{}}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 79
diff changeset
   302
$\text{eval}(n, E)$ & $\dn$ & $n$\\
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 79
diff changeset
   303
$\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
   304
$\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
   305
$\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
   306
$\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
   307
$\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
   308
$\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
   309
$\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
   310
\end{tabular}}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 79
diff changeset
   311
\end{center}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 79
diff changeset
   312
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 79
diff changeset
   313
\end{frame}}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 79
diff changeset
   314
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 79
diff changeset
   315
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 79
diff changeset
   316
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 79
diff changeset
   317
\mode<presentation>{
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 79
diff changeset
   318
\begin{frame}[c]
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 79
diff changeset
   319
\frametitle{\begin{tabular}{c}Interpreter (2)\end{tabular}}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 79
diff changeset
   320
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 79
diff changeset
   321
\begin{center}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 79
diff changeset
   322
\bl{\begin{tabular}{@{}lcl@{}}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 79
diff changeset
   323
$\text{eval}(\text{skip}, E)$ & $\dn$ & $E$\\
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 79
diff changeset
   324
$\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
   325
\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
   326
\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
   327
\text{eval}(cs_1,E)$}\\
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 79
diff changeset
   328
\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
   329
\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
   330
\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
   331
\multicolumn{3}{@{}l@{}}{\hspace{2cm}$\text{then}\;
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 79
diff changeset
   332
\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
   333
\multicolumn{3}{@{}l@{}}{\hspace{2cm}$\text{else}\; E$}\\
81
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 80
diff changeset
   334
$\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
   335
\end{tabular}}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 79
diff changeset
   336
\end{center}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 79
diff changeset
   337
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 79
diff changeset
   338
\end{frame}}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 79
diff changeset
   339
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 79
diff changeset
   340
207
f824e1331fc6 added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 206
diff changeset
   341
 
80
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 79
diff changeset
   342
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 79
diff changeset
   343
\mode<presentation>{
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 79
diff changeset
   344
\begin{frame}[t]
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 79
diff changeset
   345
\frametitle{\begin{tabular}{c}Compiling Writes\end{tabular}}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 79
diff changeset
   346
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 79
diff changeset
   347
{\Large\bl{write $x$}}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 79
diff changeset
   348
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 79
diff changeset
   349
\begin{center}
81
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 80
diff changeset
   350
\small\bl{\begin{tabular}{l}
84
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 82
diff changeset
   351
.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
   352
\;\;    .limit locals 5 \\
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 80
diff changeset
   353
\;\;    .limit stack 5 \\
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 80
diff changeset
   354
\;\;    iload 0 \\
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 80
diff changeset
   355
\;\;    getstatic java/lang/System/out Ljava/io/PrintStream;\\ 
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 80
diff changeset
   356
\;\;    swap \\
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 80
diff changeset
   357
\;\;    invokevirtual java/io/PrintStream/println(I)V \\
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 80
diff changeset
   358
\;\;    return \\
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 80
diff changeset
   359
.end method\bigskip\bigskip\\
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 80
diff changeset
   360
%
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 80
diff changeset
   361
\normalsize
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 80
diff changeset
   362
iload $E(x)$\\
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 80
diff changeset
   363
invokestatic write(I)V\\
80
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 79
diff changeset
   364
\end{tabular}}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 79
diff changeset
   365
\end{center}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 79
diff changeset
   366
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 79
diff changeset
   367
\end{frame}}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 79
diff changeset
   368
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
82
06c3ec0b452e updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 81
diff changeset
   369
06c3ec0b452e updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 81
diff changeset
   370
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
06c3ec0b452e updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 81
diff changeset
   371
\mode<presentation>{
06c3ec0b452e updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 81
diff changeset
   372
\begin{frame}[c]
06c3ec0b452e updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 81
diff changeset
   373
06c3ec0b452e updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 81
diff changeset
   374
\begin{center}
06c3ec0b452e updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 81
diff changeset
   375
\small\bl{\begin{tabular}{l}
06c3ec0b452e updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 81
diff changeset
   376
.class public XXX.XXX\\
06c3ec0b452e updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 81
diff changeset
   377
.super java/lang/Object\\
06c3ec0b452e updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 81
diff changeset
   378
\\
06c3ec0b452e updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 81
diff changeset
   379
.method public <init>()V\\
06c3ec0b452e updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 81
diff changeset
   380
\;\;     aload\_0\\
06c3ec0b452e updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 81
diff changeset
   381
\;\;     invokenonvirtual java/lang/Object/<init>()V\\
06c3ec0b452e updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 81
diff changeset
   382
 \;\;    return\\
06c3ec0b452e updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 81
diff changeset
   383
.end method\\
06c3ec0b452e updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 81
diff changeset
   384
\\
06c3ec0b452e updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 81
diff changeset
   385
.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
   386
\;\;   .limit locals 200\\
06c3ec0b452e updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 81
diff changeset
   387
\;\;     .limit stack 200\\
06c3ec0b452e updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 81
diff changeset
   388
\\
06c3ec0b452e updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 81
diff changeset
   389
   \textcolor{black}{(here comes the compiled code)}\\
06c3ec0b452e updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 81
diff changeset
   390
\\
06c3ec0b452e updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 81
diff changeset
   391
\;\;     return\\
06c3ec0b452e updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 81
diff changeset
   392
.end method\\
06c3ec0b452e updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 81
diff changeset
   393
\end{tabular}}
06c3ec0b452e updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 81
diff changeset
   394
\end{center}
06c3ec0b452e updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 81
diff changeset
   395
06c3ec0b452e updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 81
diff changeset
   396
\end{frame}}
06c3ec0b452e updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 81
diff changeset
   397
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%  
06c3ec0b452e updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 81
diff changeset
   398
65
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   399
\end{document}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   400
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   401
%%% Local Variables:  
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   402
%%% mode: latex
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   403
%%% TeX-master: t
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   404
%%% End: 
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   405