slides/slides08.tex
author Christian Urban <christian.urban@kcl.ac.uk>
Tue, 01 Dec 2020 05:41:12 +0000
changeset 813 059f970287d1
parent 744 99c5916d9a8f
child 814 1fbaa5f05516
permissions -rw-r--r--
updated
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
697
370508e4d7f6 updated
Christian Urban <urbanc@in.tum.de>
parents: 608
diff changeset
     1
% !TEX program = xelatex
744
99c5916d9a8f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 728
diff changeset
     2
\documentclass[dvipsnames,14pt,t,xelatex,aspectratio=169,xcolor={table}]{beamer}
99c5916d9a8f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 728
diff changeset
     3
%%\usepackage{xcolor}
306
fecffce112fa updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 215
diff changeset
     4
\usepackage{../slides}
215
828303e8e4af updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 197
diff changeset
     5
\usepackage{../langs}
828303e8e4af updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 197
diff changeset
     6
\usepackage{../data}
306
fecffce112fa updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 215
diff changeset
     7
\usepackage{../graphics}
600
d488a3e7b0ec updated
Christian Urban <urbanc@in.tum.de>
parents: 598
diff changeset
     8
\usepackage{../grammar}
196
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
     9
608
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
    10
\usepackage[most]{tcolorbox}
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
    11
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
    12
\newtcbox{\hl}[1][]{%
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
    13
     size=fbox,
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
    14
    tcbox raise base, nobeforeafter, 
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
    15
    enhanced, colframe=gray,
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
    16
    colback=gray!30, boxrule=1pt,
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
    17
    fontupper=\ttfamily,
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
    18
    #1}
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
    19
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
    20
\lstset{morekeywords={def,if,then,else,write,read},keywordstyle=\color{codepurple}\bfseries}
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
    21
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
    22
% beamer stuff
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
    23
\renewcommand{\slidecaption}{CFL 09, King's College London}
65
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    24
\newcommand{\bl}[1]{\textcolor{blue}{#1}}       
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    25
608
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
    26
65
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    27
\begin{document}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    28
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    29
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
306
fecffce112fa updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 215
diff changeset
    30
\begin{frame}[t]
65
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    31
\frametitle{%
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    32
  \begin{tabular}{@ {}c@ {}}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    33
  \\[-3mm]
459
780486571e38 updated
Christian Urban <urbanc@in.tum.de>
parents: 387
diff changeset
    34
  \LARGE Compilers and \\[-2mm] 
744
99c5916d9a8f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 728
diff changeset
    35
  \LARGE Formal Languages\\[3mm] 
65
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    36
  \end{tabular}}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    37
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    38
  \normalsize
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    39
  \begin{center}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    40
  \begin{tabular}{ll}
697
370508e4d7f6 updated
Christian Urban <urbanc@in.tum.de>
parents: 608
diff changeset
    41
    Email:  & christian.urban at kcl.ac.uk\\
744
99c5916d9a8f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 728
diff changeset
    42
    %Office Hours: & Thursdays 12 -- 14\\
99c5916d9a8f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 728
diff changeset
    43
    %Location: & N7.07 (North Wing, Bush House)\\
697
370508e4d7f6 updated
Christian Urban <urbanc@in.tum.de>
parents: 608
diff changeset
    44
    Slides \& Progs: & KEATS (also homework is there)\\  
65
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    45
  \end{tabular}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    46
  \end{center}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    47
744
99c5916d9a8f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 728
diff changeset
    48
  \begin{center}
99c5916d9a8f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 728
diff changeset
    49
    \begin{tikzpicture}
99c5916d9a8f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 728
diff changeset
    50
      \node[drop shadow,fill=white,inner sep=0pt] 
99c5916d9a8f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 728
diff changeset
    51
      {\footnotesize\rowcolors{1}{capri!10}{white}
99c5916d9a8f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 728
diff changeset
    52
        \begin{tabular}{|p{4.8cm}|p{4.8cm}|}\hline
99c5916d9a8f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 728
diff changeset
    53
          1 Introduction, Languages          & 6 While-Language \\
99c5916d9a8f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 728
diff changeset
    54
          2 Regular Expressions, Derivatives & 7 Compilation, JVM \\
99c5916d9a8f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 728
diff changeset
    55
          3 Automata, Regular Languages      & \cellcolor{blue!50} 8 Compiling Functional Languages \\
99c5916d9a8f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 728
diff changeset
    56
          4 Lexing, Tokenising               & 9 Optimisations \\
99c5916d9a8f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 728
diff changeset
    57
          5 Grammars, Parsing                & 10 LLVM \\ \hline
99c5916d9a8f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 728
diff changeset
    58
        \end{tabular}%
99c5916d9a8f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 728
diff changeset
    59
      };
99c5916d9a8f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 728
diff changeset
    60
    \end{tikzpicture}
99c5916d9a8f updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 728
diff changeset
    61
  \end{center}
306
fecffce112fa updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 215
diff changeset
    62
\end{frame}
608
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
    63
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
66
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
    64
813
059f970287d1 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 744
diff changeset
    65
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
059f970287d1 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 744
diff changeset
    66
% \begin{frame}[c]
66
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 65
diff changeset
    67
813
059f970287d1 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 744
diff changeset
    68
% \begin{center}
059f970287d1 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 744
diff changeset
    69
% \bl{\begin{tabular}{@{}lcl@{}}
059f970287d1 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 744
diff changeset
    70
% \meta{Stmt} & $::=$ &  $\texttt{skip}$\\
059f970287d1 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 744
diff changeset
    71
%               & $|$ & \textit{Id}\;\texttt{:=}\;\meta{AExp}\\
059f970287d1 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 744
diff changeset
    72
%               & $|$ & \texttt{if}\; \meta{BExp} \;\texttt{then}\; \meta{Block} \;\texttt{else}\; \meta{Block}\\
059f970287d1 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 744
diff changeset
    73
%               & $|$ & \texttt{while}\; \meta{BExp} \;\texttt{do}\; \meta{Block}\\
059f970287d1 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 744
diff changeset
    74
%               & $|$ & \texttt{read}\;\textit{Id}\\
059f970287d1 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 744
diff changeset
    75
%               & $|$ & \texttt{write}\;\textit{Id}\\
059f970287d1 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 744
diff changeset
    76
%               & $|$ & \texttt{write}\;\textit{String}\medskip\\
059f970287d1 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 744
diff changeset
    77
% \meta{Stmts} & $::=$ &  \meta{Stmt} \;\texttt{;}\; \meta{Stmts}\\
059f970287d1 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 744
diff changeset
    78
%               & $|$ & \meta{Stmt}\medskip\\
059f970287d1 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 744
diff changeset
    79
% \meta{Block} & $::=$ &  \texttt{\{}\,\meta{Stmts}\,\texttt{\}}\\
059f970287d1 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 744
diff changeset
    80
%                 & $|$ & \meta{Stmt}\medskip\\
059f970287d1 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 744
diff changeset
    81
% \meta{AExp} & $::=$ & \ldots\\
059f970287d1 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 744
diff changeset
    82
% \meta{BExp} & $::=$ & \ldots\\
059f970287d1 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 744
diff changeset
    83
% \end{tabular}}
059f970287d1 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 744
diff changeset
    84
% \end{center}
059f970287d1 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 744
diff changeset
    85
% \end{frame}
059f970287d1 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 744
diff changeset
    86
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
69
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 67
diff changeset
    87
813
059f970287d1 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 744
diff changeset
    88
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
059f970287d1 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 744
diff changeset
    89
% \begin{frame}[t,fragile]
059f970287d1 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 744
diff changeset
    90
% \frametitle{Compiling AExps}
196
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
    91
813
059f970287d1 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 744
diff changeset
    92
% For example \bl{$1 + ((2 * 3) + (4 - 3))$}:\medskip
608
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
    93
813
059f970287d1 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 744
diff changeset
    94
% \begin{columns}[T]
059f970287d1 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 744
diff changeset
    95
% \begin{column}{.3\textwidth}
059f970287d1 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 744
diff changeset
    96
% \begin{center}
059f970287d1 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 744
diff changeset
    97
% \bl{\begin{tikzpicture}
059f970287d1 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 744
diff changeset
    98
% \tikzset{level distance=12mm,sibling distance=4mm}
059f970287d1 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 744
diff changeset
    99
% \tikzset{edge from parent/.style={draw,very thick}}
059f970287d1 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 744
diff changeset
   100
% \Tree [.$+$ [.$1$ ] [.$+$ [.$*$ $2$ $3$ ] [.$-$ $4$ $3$ ]]]
059f970287d1 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 744
diff changeset
   101
% \end{tikzpicture}}
059f970287d1 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 744
diff changeset
   102
% \end{center}
059f970287d1 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 744
diff changeset
   103
% \end{column}
059f970287d1 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 744
diff changeset
   104
% \begin{column}{.3\textwidth}
059f970287d1 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 744
diff changeset
   105
% \begin{lstlisting}[language=JVMIS,numbers=none]
059f970287d1 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 744
diff changeset
   106
% ldc 1 
059f970287d1 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 744
diff changeset
   107
% ldc 2 
059f970287d1 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 744
diff changeset
   108
% ldc 3 
059f970287d1 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 744
diff changeset
   109
% imul 
059f970287d1 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 744
diff changeset
   110
% ldc 4 
059f970287d1 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 744
diff changeset
   111
% ldc 3 
059f970287d1 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 744
diff changeset
   112
% isub 
059f970287d1 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 744
diff changeset
   113
% iadd 
059f970287d1 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 744
diff changeset
   114
% iadd
059f970287d1 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 744
diff changeset
   115
% \end{lstlisting}
059f970287d1 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 744
diff changeset
   116
% \end{column}
059f970287d1 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 744
diff changeset
   117
% \end{columns}\bigskip
535
095be64c03c1 updated
Christian Urban <urbanc@in.tum.de>
parents: 534
diff changeset
   118
813
059f970287d1 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 744
diff changeset
   119
% \small
059f970287d1 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 744
diff changeset
   120
% Traverse tree in post-order \bl{$\Rightarrow$} code for 
059f970287d1 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 744
diff changeset
   121
% stack-machine
535
095be64c03c1 updated
Christian Urban <urbanc@in.tum.de>
parents: 534
diff changeset
   122
813
059f970287d1 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 744
diff changeset
   123
% \end{frame}
059f970287d1 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 744
diff changeset
   124
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
196
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   125
813
059f970287d1 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 744
diff changeset
   126
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
059f970287d1 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 744
diff changeset
   127
% \begin{frame}[c,fragile]
059f970287d1 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 744
diff changeset
   128
% \frametitle{Compiling AExps}
196
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   129
813
059f970287d1 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 744
diff changeset
   130
% \bl{
059f970287d1 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 744
diff changeset
   131
% \begin{center}
059f970287d1 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 744
diff changeset
   132
% \begin{tabular}{lcl}
059f970287d1 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 744
diff changeset
   133
% $\textit{compile}(n, E)$ & $\dn$ & $\pcode{ldc}\;n$\smallskip\\
059f970287d1 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 744
diff changeset
   134
% $\textit{compile}(a_1 + a_2, E)$ & $\dn$ \\
059f970287d1 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 744
diff changeset
   135
% \multicolumn{3}{c}{$\qquad\textit{compile}(a_1, E) \;@\;\textit{compile}(a_2, E)\;@\; \pcode{iadd}$}\smallskip\\
059f970287d1 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 744
diff changeset
   136
% $\textit{compile}(a_1 - a_2, E)$ & $\dn$ \\
059f970287d1 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 744
diff changeset
   137
% \multicolumn{3}{c}{$\qquad\textit{compile}(a_1, E) \;@\; \textit{compile}(a_2, E)\;@\; \pcode{isub}$}\smallskip\\
059f970287d1 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 744
diff changeset
   138
% $\textit{compile}(a_1 * a_2, E)$ & $\dn$ \\
059f970287d1 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 744
diff changeset
   139
% \multicolumn{3}{c}{$\qquad\textit{compile}(a_1, E) \;@\; \textit{compile}(a_2, E)\;@\; \pcode{imul}$}\smallskip\\
059f970287d1 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 744
diff changeset
   140
% $\textit{compile}(a_1 \backslash a_2, E)$ & $\dn$\\ 
059f970287d1 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 744
diff changeset
   141
% \multicolumn{3}{c}{$\qquad\textit{compile}(a_1, E) \;@\; \textit{compile}(a_2, E)\;@\; \pcode{idiv}$}\smallskip\\
059f970287d1 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 744
diff changeset
   142
% $\textit{compile}(x, E)$ & $\dn$ & $\pcode{iload}\;E(x)$\\
059f970287d1 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 744
diff changeset
   143
% \end{tabular}
059f970287d1 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 744
diff changeset
   144
% \end{center}}
196
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   145
813
059f970287d1 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 744
diff changeset
   146
% \end{frame}
059f970287d1 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 744
diff changeset
   147
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
196
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   148
813
059f970287d1 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 744
diff changeset
   149
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
059f970287d1 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 744
diff changeset
   150
% \begin{frame}[c,fragile]
059f970287d1 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 744
diff changeset
   151
% \frametitle{Compiling Ifs}
534
Christian Urban <urbanc@in.tum.de>
parents: 532
diff changeset
   152
813
059f970287d1 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 744
diff changeset
   153
% For example
534
Christian Urban <urbanc@in.tum.de>
parents: 532
diff changeset
   154
813
059f970287d1 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 744
diff changeset
   155
% \begin{lstlisting}[mathescape,numbers=none,language=While]
059f970287d1 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 744
diff changeset
   156
% if 1 = 1 then x := 2 else y := 3
059f970287d1 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 744
diff changeset
   157
% \end{lstlisting}
534
Christian Urban <urbanc@in.tum.de>
parents: 532
diff changeset
   158
Christian Urban <urbanc@in.tum.de>
parents: 532
diff changeset
   159
813
059f970287d1 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 744
diff changeset
   160
% \begin{center}
059f970287d1 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 744
diff changeset
   161
% \begin{lstlisting}[mathescape,language=JVMIS,numbers=none]
059f970287d1 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 744
diff changeset
   162
%    ldc 1
059f970287d1 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 744
diff changeset
   163
%    ldc 1
059f970287d1 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 744
diff changeset
   164
%    if_icmpne L_ifelse $\quad\tikz[remember picture] \node (C) {\mbox{}};$
059f970287d1 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 744
diff changeset
   165
%    ldc 2
059f970287d1 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 744
diff changeset
   166
%    istore 0
059f970287d1 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 744
diff changeset
   167
%    goto L_ifend $\quad\tikz[remember picture] \node (A) {\mbox{}};$
059f970287d1 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 744
diff changeset
   168
% L_ifelse: $\quad\tikz[remember picture] \node[] (D) {\mbox{}};$
059f970287d1 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 744
diff changeset
   169
%    ldc 3
059f970287d1 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 744
diff changeset
   170
%    istore 1
059f970287d1 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 744
diff changeset
   171
% L_ifend: $\quad\tikz[remember picture] \node[] (B) {\mbox{}};$
059f970287d1 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 744
diff changeset
   172
% \end{lstlisting}
059f970287d1 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 744
diff changeset
   173
% \end{center}
534
Christian Urban <urbanc@in.tum.de>
parents: 532
diff changeset
   174
813
059f970287d1 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 744
diff changeset
   175
% \begin{tikzpicture}[remember picture,overlay]
059f970287d1 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 744
diff changeset
   176
%   \draw[->,very thick] (A) edge [->,to path={-- ++(10mm,0mm) 
059f970287d1 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 744
diff changeset
   177
%            -- ++(0mm,-17.3mm) |- (\tikztotarget)},line width=1mm] (B.east);
059f970287d1 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 744
diff changeset
   178
%   \draw[->,very thick] (C) edge [->,to path={-- ++(10mm,0mm) 
059f970287d1 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 744
diff changeset
   179
%            -- ++(0mm,-17.3mm) |- (\tikztotarget)},line width=1mm] (D.east);
059f970287d1 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 744
diff changeset
   180
% \end{tikzpicture}
196
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   181
813
059f970287d1 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 744
diff changeset
   182
% \end{frame}
059f970287d1 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 744
diff changeset
   183
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
196
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   184
813
059f970287d1 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 744
diff changeset
   185
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
059f970287d1 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 744
diff changeset
   186
% \begin{frame}[c,fragile]
059f970287d1 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 744
diff changeset
   187
% \frametitle{Compiling Whiles}
534
Christian Urban <urbanc@in.tum.de>
parents: 532
diff changeset
   188
813
059f970287d1 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 744
diff changeset
   189
% For example
196
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   190
813
059f970287d1 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 744
diff changeset
   191
% \begin{lstlisting}[mathescape,numbers=none,language=While]
059f970287d1 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 744
diff changeset
   192
% while x <= 10 do x := x + 1
059f970287d1 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 744
diff changeset
   193
% \end{lstlisting}
534
Christian Urban <urbanc@in.tum.de>
parents: 532
diff changeset
   194
196
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   195
813
059f970287d1 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 744
diff changeset
   196
% \begin{center}
059f970287d1 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 744
diff changeset
   197
% \begin{lstlisting}[mathescape,language=JVMIS,numbers=none]
059f970287d1 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 744
diff changeset
   198
% L_wbegin: $\quad\tikz[remember picture] \node[] (LB) {\mbox{}};$
059f970287d1 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 744
diff changeset
   199
%    iload 0
059f970287d1 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 744
diff changeset
   200
%    ldc 10
059f970287d1 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 744
diff changeset
   201
%    if_icmpgt L_wend $\quad\tikz[remember picture] \node (LC) {\mbox{}};$
059f970287d1 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 744
diff changeset
   202
%    iload 0
059f970287d1 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 744
diff changeset
   203
%    ldc 1
059f970287d1 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 744
diff changeset
   204
%    iadd
059f970287d1 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 744
diff changeset
   205
%    istore 0
059f970287d1 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 744
diff changeset
   206
%    goto L_wbegin $\quad\tikz[remember picture] \node (LA) {\mbox{}};$
059f970287d1 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 744
diff changeset
   207
% L_wend: $\quad\tikz[remember picture] \node[] (LD) {\mbox{}};$
059f970287d1 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 744
diff changeset
   208
% \end{lstlisting}
059f970287d1 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 744
diff changeset
   209
% \end{center}
196
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   210
813
059f970287d1 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 744
diff changeset
   211
% \begin{tikzpicture}[remember picture,overlay]
059f970287d1 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 744
diff changeset
   212
%   \draw[->,very thick] (LA) edge [->,to path={-- ++(12mm,0mm) 
059f970287d1 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 744
diff changeset
   213
%            -- ++(0mm,17.3mm) |- (\tikztotarget)},line width=1mm] (LB.east);
059f970287d1 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 744
diff changeset
   214
%   \draw[->,very thick] (LC) edge [->,to path={-- ++(12mm,0mm) 
059f970287d1 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 744
diff changeset
   215
%            -- ++(0mm,-17.3mm) |- (\tikztotarget)},line width=1mm] (LD.east);
059f970287d1 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 744
diff changeset
   216
% \end{tikzpicture}
534
Christian Urban <urbanc@in.tum.de>
parents: 532
diff changeset
   217
813
059f970287d1 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 744
diff changeset
   218
% \end{frame}
059f970287d1 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 744
diff changeset
   219
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
196
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   220
813
059f970287d1 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 744
diff changeset
   221
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
059f970287d1 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 744
diff changeset
   222
% \begin{frame}[c,fragile]
059f970287d1 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 744
diff changeset
   223
% \frametitle{Compiling Writes}
534
Christian Urban <urbanc@in.tum.de>
parents: 532
diff changeset
   224
813
059f970287d1 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 744
diff changeset
   225
% \small
059f970287d1 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 744
diff changeset
   226
% \begin{lstlisting}[language=JVMIS,mathescape,
059f970287d1 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 744
diff changeset
   227
%                    numbers=none,xleftmargin=-6mm]
059f970287d1 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 744
diff changeset
   228
% .method public static write(I)V 
059f970287d1 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 744
diff changeset
   229
%   .limit locals 1 
059f970287d1 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 744
diff changeset
   230
%   .limit stack 2 
059f970287d1 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 744
diff changeset
   231
%   getstatic java/lang/System/out 
059f970287d1 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 744
diff changeset
   232
%                             Ljava/io/PrintStream; 
059f970287d1 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 744
diff changeset
   233
%   iload 0
059f970287d1 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 744
diff changeset
   234
%   invokevirtual java/io/PrintStream/println(I)V 
059f970287d1 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 744
diff changeset
   235
%   return 
059f970287d1 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 744
diff changeset
   236
% .end method
534
Christian Urban <urbanc@in.tum.de>
parents: 532
diff changeset
   237
Christian Urban <urbanc@in.tum.de>
parents: 532
diff changeset
   238
Christian Urban <urbanc@in.tum.de>
parents: 532
diff changeset
   239
813
059f970287d1 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 744
diff changeset
   240
% iload $E(x)$ 
059f970287d1 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 744
diff changeset
   241
% invokestatic XXX/XXX/write(I)V
059f970287d1 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 744
diff changeset
   242
% \end{lstlisting}
534
Christian Urban <urbanc@in.tum.de>
parents: 532
diff changeset
   243
813
059f970287d1 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 744
diff changeset
   244
% \end{frame}
059f970287d1 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 744
diff changeset
   245
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
534
Christian Urban <urbanc@in.tum.de>
parents: 532
diff changeset
   246
813
059f970287d1 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 744
diff changeset
   247
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
059f970287d1 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 744
diff changeset
   248
% \begin{frame}[c,fragile]
059f970287d1 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 744
diff changeset
   249
% \frametitle{Compiling Main}
534
Christian Urban <urbanc@in.tum.de>
parents: 532
diff changeset
   250
813
059f970287d1 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 744
diff changeset
   251
% \footnotesize
059f970287d1 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 744
diff changeset
   252
% \begin{lstlisting}[language=JVMIS,mathescape,
059f970287d1 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 744
diff changeset
   253
%                    numbers=none,xleftmargin=-6mm]
059f970287d1 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 744
diff changeset
   254
% .class public XXX.XXX
059f970287d1 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 744
diff changeset
   255
% .super java/lang/Object
534
Christian Urban <urbanc@in.tum.de>
parents: 532
diff changeset
   256
813
059f970287d1 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 744
diff changeset
   257
% .method public <init>()V
059f970287d1 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 744
diff changeset
   258
%     aload_0
059f970287d1 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 744
diff changeset
   259
%     invokenonvirtual java/lang/Object/<init>()V
059f970287d1 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 744
diff changeset
   260
%     return
059f970287d1 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 744
diff changeset
   261
% .end method
534
Christian Urban <urbanc@in.tum.de>
parents: 532
diff changeset
   262
813
059f970287d1 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 744
diff changeset
   263
% .method public static main([Ljava/lang/String;)V
059f970287d1 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 744
diff changeset
   264
%     .limit locals 200
059f970287d1 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 744
diff changeset
   265
%     .limit stack 200
534
Christian Urban <urbanc@in.tum.de>
parents: 532
diff changeset
   266
813
059f970287d1 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 744
diff changeset
   267
%       $\textit{\ldots{}here comes the compiled code\ldots}$
534
Christian Urban <urbanc@in.tum.de>
parents: 532
diff changeset
   268
813
059f970287d1 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 744
diff changeset
   269
%     return
059f970287d1 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 744
diff changeset
   270
% .end method
059f970287d1 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 744
diff changeset
   271
% \end{lstlisting}
534
Christian Urban <urbanc@in.tum.de>
parents: 532
diff changeset
   272
813
059f970287d1 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 744
diff changeset
   273
% \end{frame}
059f970287d1 updated
Christian Urban <christian.urban@kcl.ac.uk>
parents: 744
diff changeset
   274
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
534
Christian Urban <urbanc@in.tum.de>
parents: 532
diff changeset
   275
Christian Urban <urbanc@in.tum.de>
parents: 532
diff changeset
   276
196
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   277
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
608
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   278
\begin{frame}[c,fragile]
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   279
\frametitle{Functional Programming}
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   280
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   281
\footnotesize
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   282
\begin{textblock}{13}(0.9,3)
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   283
\begin{lstlisting}[]numbers=none]
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   284
def fib(n) = if n == 0 then 0 
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   285
             else if n == 1 then 1 
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   286
             else fib(n - 1) + fib(n - 2);
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   287
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   288
def fact(n) = if n == 0 then 1 else n * fact(n - 1);
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   289
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   290
def ack(m, n) = if m == 0 then n + 1
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   291
                else if n == 0 then ack(m - 1, 1)
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   292
                else ack(m - 1, ack(m, n - 1));
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   293
                
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   294
def gcd(a, b) = if b == 0 then a else gcd(b, a % b);                
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   295
\end{lstlisting}
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   296
\end{textblock}
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   297
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   298
\end{frame}
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   299
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
196
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   300
608
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   301
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   302
\begin{frame}[c]
697
370508e4d7f6 updated
Christian Urban <urbanc@in.tum.de>
parents: 608
diff changeset
   303
\frametitle{Fun-Grammar}
608
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   304
\bl{
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   305
\begin{plstx}[rhs style=]
697
370508e4d7f6 updated
Christian Urban <urbanc@in.tum.de>
parents: 608
diff changeset
   306
: \meta{Exp} ::= \meta{Var} | \meta{Num}{\hspace{4cm}}
608
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   307
             |   \meta{Exp} + \meta{Exp} | ... | (\meta{Exp})
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   308
             |   \code{if} \meta{BExp} \code{then} \meta{Exp} \code{else} \meta{Exp}
697
370508e4d7f6 updated
Christian Urban <urbanc@in.tum.de>
parents: 608
diff changeset
   309
             |   \code{write} \meta{Exp} {\hspace{5cm}}
608
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   310
             |   \meta{Exp} ; \meta{Exp}
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   311
             |   \textit{FunName} (\meta{Exp}, ... , \meta{Exp})\\
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   312
: \meta{BExp} ::= ...\\
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   313
: \meta{Def} ::= \code{def} \textit{FunName} ($\hspace{0.4mm}x_1$, ... , $x_n$) = \meta{Exp}\\               
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   314
: \meta{Prog} ::= \meta{Def} ; \meta{Prog}
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   315
               | \meta{Exp} ; \meta{Prog}
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   316
               | \meta{Exp}\\
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   317
\end{plstx}}
196
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   318
608
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   319
% Almost what is implemented - Exp ; Exp is left-recursive
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   320
%
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   321
\end{frame}
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   322
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
196
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   323
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   324
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
608
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   325
\begin{frame}[c, fragile]
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   326
\frametitle{Abstract Syntax Trees}
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   327
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   328
\footnotesize
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   329
\begin{lstlisting}[language=Scala, numbers=none, xleftmargin=-1mm]
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   330
abstract class Exp
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   331
abstract class BExp 
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   332
abstract class Decl
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   333
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   334
case class Var(s: String) extends Exp
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   335
case class Num(i: Int) extends Exp
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   336
case class Aop(o: String, a1: Exp, a2: Exp) extends Exp
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   337
case class If(a: BExp, e1: Exp, e2: Exp) extends Exp
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   338
case class Write(e: Exp) extends Exp
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   339
case class Sequ(e1: Exp, e2: Exp) extends Exp
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   340
case class Call(name: String, args: List[Exp]) extends Exp
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   341
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   342
case class Bop(o: String, a1: Exp, a2: Exp) extends BExp
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   343
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   344
case class Def(name: String, 
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   345
               args: List[String], 
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   346
               body: Exp) extends Decl
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   347
case class Main(e: Exp) extends Decl
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   348
\end{lstlisting}
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   349
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   350
\end{frame}
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   351
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   352
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   353
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   354
\begin{frame}[c, fragile]
697
370508e4d7f6 updated
Christian Urban <urbanc@in.tum.de>
parents: 608
diff changeset
   355
\frametitle{Ideas}
608
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   356
697
370508e4d7f6 updated
Christian Urban <urbanc@in.tum.de>
parents: 608
diff changeset
   357
Use separate JVM methods for each Fun-function.\bigskip
370508e4d7f6 updated
Christian Urban <urbanc@in.tum.de>
parents: 608
diff changeset
   358
370508e4d7f6 updated
Christian Urban <urbanc@in.tum.de>
parents: 608
diff changeset
   359
Compile \bl{\texttt{exp}}s such that the result of the expression
608
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   360
is on top of the stack.\bigskip
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   361
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   362
\begin{itemize}
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   363
\item \texttt{\color{codepurple}{write}}\texttt{(1 + 2)}
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   364
\item \texttt{1 + 2; 3 + 4} 
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   365
\end{itemize}
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   366
  
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   367
\end{frame}
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   368
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
196
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   369
608
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   370
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   371
\begin{frame}[c, fragile]
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   372
\frametitle{Sequences}
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   373
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   374
Compiling \texttt{exp1 ; exp2}:\bigskip
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   375
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   376
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   377
\begin{lstlisting}[mathescape,language=JVMIS, numbers=none]
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   378
$\textit{compile}$(exp1)
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   379
pop
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   380
$\textit{compile}$(exp2)
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   381
\end{lstlisting}
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   382
  
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   383
\end{frame}
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   384
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   385
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   386
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   387
\begin{frame}[t, fragile]
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   388
\frametitle{Write}
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   389
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   390
Compiling call to \texttt{write(1+2)}:\bigskip
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   391
196
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   392
608
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   393
\begin{lstlisting}[mathescape,language=JVMIS, numbers=none]
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   394
$\textit{compile}$(1+2)
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   395
dup
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   396
invokestatic XXX/XXX/write(I)V
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   397
\end{lstlisting}\bigskip
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   398
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   399
\small
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   400
needs the helper method
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   401
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   402
\footnotesize
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   403
\begin{lstlisting}[language=JVMIS, 
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   404
                   xleftmargin=2mm, 
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   405
                   numbers=none]
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   406
.method public static write(I)V 
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   407
   .limit locals 1
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   408
   .limit stack 2
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   409
   getstatic java/lang/System/out Ljava/io/PrintStream; 
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   410
   iload 0 
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   411
   invokevirtual java/io/PrintStream/println(I)V 
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   412
   return 
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   413
.end method
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   414
\end{lstlisting}
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   415
\end{frame}
196
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   416
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   417
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   418
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   419
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   420
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
608
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   421
\begin{frame}[t, fragile]
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   422
\frametitle{Function Definitions}
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   423
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   424
\footnotesize
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   425
\begin{lstlisting}[language=JVMIS, 
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   426
                   xleftmargin=2mm, 
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   427
                   numbers=none]
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   428
.method public static write(I)V 
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   429
   .limit locals 1
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   430
   .limit stack 2
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   431
   getstatic java/lang/System/out Ljava/io/PrintStream; 
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   432
   iload 0 
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   433
   invokevirtual java/io/PrintStream/println(I)V 
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   434
   return 
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   435
.end method
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   436
\end{lstlisting}\bigskip
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   437
697
370508e4d7f6 updated
Christian Urban <urbanc@in.tum.de>
parents: 608
diff changeset
   438
\small We will need methods for definitions like\footnotesize\medskip
608
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   439
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   440
\begin{lstlisting}[language=JVMIS, 
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   441
                   xleftmargin=2mm, 
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   442
                   numbers=none]
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   443
def fname (x1, ... , xn) = ...                   
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   444
                   
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   445
.method public static fname (I...I)I
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   446
  .limit locals ??
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   447
  .limit stack ?? 
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   448
  ??
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   449
.end method
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   450
\end{lstlisting}
196
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   451
608
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   452
\end{frame}
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   453
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   454
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   455
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   456
\begin{frame}[c, fragile]
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   457
\frametitle{Stack Estimation}
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   458
\small
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   459
\mbox{}\\[-15mm]
196
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   460
608
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   461
\bl{\begin{center}
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   462
\begin{tabular}{@{\hspace{-4mm}}l@{\hspace{2mm}}c@{\hspace{2mm}}l@{}}
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   463
$\textit{estimate}(n)$ & $\dn$ & $1$\\
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   464
$\textit{estimate}(x)$ & $\dn$ & $1$\\
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   465
$\textit{estimate}(a_1\;aop\;a_2)$ & $\dn$ &
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   466
$\textit{estimate}(a_1) + \textit{estimate}(a_2)$\\
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   467
$\textit{estimate}(\pcode{if}\;b\;\pcode{then}\;e_1\;\pcode{else}\;e_2)$ & $\dn$ & 
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   468
$\textit{estimate}(b) +$\\ 
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   469
& & $\quad max(\textit{estimate}(e_1), \textit{estimate}(e_2))$\\
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   470
$\textit{estimate}(\pcode{write}(e))$ & $\dn$ & 
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   471
$\textit{estimate}(e) + 1$\\
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   472
$\textit{estimate}(e_1 ; e_2)$ & $\dn$ & 
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   473
$max(\textit{estimate}(e_1), \textit{estimate}(e_2))$\\
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   474
$\textit{estimate}(f(e_1, ..., e_n))$ & $\dn$ & 
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   475
$\sum_{i = 1..n}\;estimate(e_i)$\medskip\\
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   476
$\textit{estimate}(a_1\;bop\;a_2)$ & $\dn$ &
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   477
$\textit{estimate}(a_1) + \textit{estimate}(a_2)$\\
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   478
\end{tabular}
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   479
\end{center}}
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   480
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   481
\end{frame}
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   482
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
196
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   483
197
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 196
diff changeset
   484
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
608
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   485
\begin{frame}[fragile]
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   486
\frametitle{Successor Function}
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   487
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   488
\begin{textblock}{7}(1,2.5)\footnotesize
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   489
\begin{minipage}{6cm}
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   490
\begin{lstlisting}[language=JVMIS,basicstyle=\ttfamily, numbers=none]
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   491
.method public static suc(I)I 
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   492
.limit locals 1
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   493
.limit stack 2
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   494
  iload 0
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   495
  ldc 1
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   496
  iadd
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   497
  ireturn
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   498
.end method 
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   499
\end{lstlisting}
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   500
\end{minipage}
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   501
\end{textblock}
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   502
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   503
\begin{textblock}{7}(6,8)
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   504
\begin{bubble}[5cm]\small
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   505
\begin{lstlisting}[language=Lisp,
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   506
                   basicstyle=\ttfamily, 
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   507
                   numbers=none,
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   508
                   xleftmargin=1mm,linebackgroundcolor=\color{cream}]
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   509
def suc(x) = x + 1;
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   510
\end{lstlisting}
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   511
\end{bubble}
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   512
\end{textblock}
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   513
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   514
\end{frame}
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   515
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   516
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   517
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   518
\begin{frame}[fragile]
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   519
\frametitle{Addition Function}
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   520
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   521
\begin{textblock}{7}(1,1.9)\footnotesize
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   522
\begin{minipage}{6cm}
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   523
\begin{lstlisting}[language=JVMIS,basicstyle=\ttfamily, numbers=none]
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   524
.method public static add(II)I 
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   525
.limit locals 2
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   526
.limit stack 5
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   527
  iload 0
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   528
  ldc 0
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   529
  if_icmpne If_else
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   530
  iload 1
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   531
  goto If_end
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   532
If_else:
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   533
  iload 0
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   534
  ldc 1
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   535
  isub
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   536
  iload 1
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   537
  invokestatic XXX/XXX/add(II)I
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   538
  invokestatic XXX/XXX/suc(I)I
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   539
If_end:
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   540
  ireturn
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   541
.end method
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   542
\end{lstlisting}
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   543
\end{minipage}
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   544
\end{textblock}
196
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   545
608
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   546
\begin{textblock}{7}(6,6.6)
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   547
\begin{bubble}[7cm]\small
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   548
\begin{lstlisting}[language=Lisp,
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   549
                   basicstyle=\ttfamily, 
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   550
                   numbers=none,
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   551
                   xleftmargin=1mm,linebackgroundcolor=\color{cream}]
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   552
def add(x, y) = 
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   553
    if x == 0 then y 
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   554
    else suc(add(x - 1, y));
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   555
\end{lstlisting}
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   556
\end{bubble}
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   557
\end{textblock}
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   558
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   559
\end{frame}
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   560
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   561
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   562
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   563
\begin{frame}[c,fragile]
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   564
\frametitle{Factorial}
197
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 196
diff changeset
   565
608
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   566
\begin{textblock}{7}(1,1.8)\footnotesize
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   567
\begin{minipage}{6cm}
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   568
\begin{lstlisting}[language=JVMIS,basicstyle=\ttfamily, numbers=none]
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   569
.method public static facT(II)I 
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   570
.limit locals 2
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   571
.limit stack 6
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   572
  iload 0
701
681c36b2af27 updated
Christian Urban <urbanc@in.tum.de>
parents: 697
diff changeset
   573
  ldc 0
608
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   574
  if_icmpne If_else_2
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   575
  iload 1
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   576
  goto If_end_3
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   577
If_else_2:
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   578
  iload 0
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   579
  ldc 1
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   580
  isub
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   581
  iload 0
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   582
  iload 1
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   583
  imul
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   584
  invokestatic fact/fact/facT(II)I
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   585
If_end_3:
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   586
  ireturn
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   587
.end method 
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   588
\end{lstlisting}
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   589
\end{minipage}
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   590
\end{textblock}
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   591
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   592
\begin{textblock}{7}(6,7)
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   593
\begin{bubble}[7cm]\small
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   594
\begin{lstlisting}[language=Lisp,
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   595
                   basicstyle=\ttfamily, 
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   596
                   numbers=none,
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   597
                   xleftmargin=1mm,linebackgroundcolor=\color{cream}]
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   598
def facT(n, acc) = 
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   599
  if n == 0 then acc 
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   600
  else facT(n - 1, n * acc);
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   601
\end{lstlisting}
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   602
\end{bubble}
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   603
\end{textblock}
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   604
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   605
\end{frame}
197
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 196
diff changeset
   606
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
196
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   607
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   608
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
608
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   609
\begin{frame}[fragile]
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   610
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   611
\begin{textblock}{7}(1,-0.2)\footnotesize
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   612
\begin{minipage}{6cm}
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   613
\begin{lstlisting}[language=JVMIS,basicstyle=\ttfamily, numbers=none, escapeinside={(*@}{@*)}]
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   614
.method public static facT(II)I 
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   615
.limit locals 2
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   616
.limit stack 6
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   617
(*@\hl{facT\_Start:} @*)
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   618
  iload 0
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   619
  ldc 0
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   620
  if_icmpne If_else_2
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   621
  iload 1
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   622
  goto If_end_3
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   623
If_else_2:
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   624
  iload 0
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   625
  ldc 1
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   626
  isub
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   627
  iload 0
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   628
  iload 1
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   629
  imul
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   630
  (*@\hl{istore 1} @*)
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   631
  (*@\hl{istore 0} @*)
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   632
  (*@\hl{goto facT\_Start} @*)
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   633
If_end_3:
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   634
  ireturn
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   635
.end method 
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   636
\end{lstlisting}
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   637
\end{minipage}
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   638
\end{textblock}
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   639
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   640
\begin{textblock}{7}(6,7)
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   641
\begin{bubble}[7cm]\small
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   642
\begin{lstlisting}[language=Lisp,
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   643
                   basicstyle=\ttfamily, 
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   644
                   numbers=none,
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   645
                   xleftmargin=1mm,linebackgroundcolor=\color{cream}]
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   646
def facT(n, acc) = 
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   647
  if n == 0 then acc 
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   648
  else facT(n - 1, n * acc);
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   649
\end{lstlisting}
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   650
\end{bubble}
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   651
\end{textblock}
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   652
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   653
\end{frame}
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   654
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   655
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   656
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   657
\begin{frame}[t, fragile]
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   658
\frametitle{Tail Recursion}
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   659
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   660
A call to \texttt{f(args)} is usually compiled as\medskip
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   661
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   662
{\small\begin{lstlisting}[basicstyle=\ttfamily, numbers=none]
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   663
  args onto stack
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   664
  invokestatic  .../f 
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   665
\end{lstlisting}}\pause
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   666
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   667
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   668
A call is in tail position provided:\medskip
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   669
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   670
{\small\begin{itemize}
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   671
\item \texttt{if Bexp then \hl{Exp} else \hl{Exp}}
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   672
\item \texttt{Exp ; \hl{Exp}}
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   673
\item \texttt{Exp  op Exp}
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   674
\end{itemize}}\medskip
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   675
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   676
then a call \texttt{f(args)} can be compiled as\medskip\small
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   677
697
370508e4d7f6 updated
Christian Urban <urbanc@in.tum.de>
parents: 608
diff changeset
   678
\begin{lstlisting}[numbers=none]
608
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   679
  prepare environment
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   680
  jump to start of function
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   681
\end{lstlisting}
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   682
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   683
\end{frame}
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   684
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   685
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   686
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   687
\begin{frame}[c, fragile]
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   688
\frametitle{Tail Recursive Call}
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   689
\footnotesize
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   690
697
370508e4d7f6 updated
Christian Urban <urbanc@in.tum.de>
parents: 608
diff changeset
   691
\begin{textblock}{13}(-0.3,3)
370508e4d7f6 updated
Christian Urban <urbanc@in.tum.de>
parents: 608
diff changeset
   692
\begin{lstlisting}[language=Scala, numbers=none]
608
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   693
def compile_expT(a: Exp, env: Mem, name: String): Instrs = 
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   694
  ...
697
370508e4d7f6 updated
Christian Urban <urbanc@in.tum.de>
parents: 608
diff changeset
   695
  case Call(n, args) => if (name == n)
608
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   696
  {
697
370508e4d7f6 updated
Christian Urban <urbanc@in.tum.de>
parents: 608
diff changeset
   697
    val stores =
370508e4d7f6 updated
Christian Urban <urbanc@in.tum.de>
parents: 608
diff changeset
   698
      args.zipWithIndex.map { case (x, y) => i"istore $y" } 
370508e4d7f6 updated
Christian Urban <urbanc@in.tum.de>
parents: 608
diff changeset
   699
370508e4d7f6 updated
Christian Urban <urbanc@in.tum.de>
parents: 608
diff changeset
   700
    args.map(a => compile_expT(a, env, "")).mkString ++
370508e4d7f6 updated
Christian Urban <urbanc@in.tum.de>
parents: 608
diff changeset
   701
    stores.reverse.mkString ++ 
370508e4d7f6 updated
Christian Urban <urbanc@in.tum.de>
parents: 608
diff changeset
   702
    i"goto ${n}_Start" 
370508e4d7f6 updated
Christian Urban <urbanc@in.tum.de>
parents: 608
diff changeset
   703
  } else {
608
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   704
    val is = "I" * args.length
697
370508e4d7f6 updated
Christian Urban <urbanc@in.tum.de>
parents: 608
diff changeset
   705
    args.map(a => compile_expT(a, env, "")).mkString ++
370508e4d7f6 updated
Christian Urban <urbanc@in.tum.de>
parents: 608
diff changeset
   706
    i"invokestatic XXX/XXX/${n}(${is})I"
608
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   707
  }
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   708
\end{lstlisting}
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   709
\end{textblock}
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   710
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   711
\end{frame}
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   712
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   713
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   714
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   715
  \begin{frame}[c]
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   716
  \frametitle{Dijkstra on Testing}
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   717
  
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   718
  \begin{bubble}[10cm]
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   719
  ``Program testing can be a very effective way to show the
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   720
  presence of bugs, but it is hopelessly inadequate for showing
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   721
  their absence.''
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   722
  \end{bubble}\bigskip
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   723
  
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   724
  \small
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   725
  What is good about compilers: the either seem to work,
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   726
  or go horribly wrong (most of the time).
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   727
  
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   728
  \end{frame}
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   729
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   730
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   731
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   732
\begin{frame}[c]
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   733
\frametitle{\Large Proving Programs to be Correct}
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   734
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   735
\begin{bubble}[10cm]
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   736
\small
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   737
{\bf Theorem:} There are infinitely many prime 
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   738
numbers.\medskip\\
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   739
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   740
{\bf Proof} \ldots\\
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   741
\end{bubble}\bigskip
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   742
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   743
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   744
similarly\bigskip
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   745
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   746
\begin{bubble}[10cm]
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   747
\small
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   748
{\bf Theorem:} The program is doing what 
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   749
it is supposed to be doing.\medskip
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   750
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   751
{\bf Long, long proof} \ldots\\
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   752
\end{bubble}\bigskip\medskip
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   753
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   754
\small This can be a gigantic proof. The only hope is to have
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   755
help from the computer. `Program' is here to be understood to be
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   756
quite general (compiler, OS, \ldots).
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   757
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   758
\end{frame}
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   759
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%  
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   760
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   761
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   762
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%     
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   763
\begin{frame}[c]
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   764
\frametitle{Can This Be Done?}
196
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   765
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   766
\begin{itemize}
608
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   767
\item in 2008, verification of a small C-compiler
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   768
\begin{itemize}
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   769
\item ``if my input program has a certain behaviour, then the compiled machine code has the same behaviour''
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   770
\item is as good as \texttt{gcc -O1}, but much, much less buggy 
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   771
\end{itemize}
196
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   772
\end{itemize}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   773
608
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   774
\begin{center}
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   775
  \includegraphics[scale=0.12]{../pics/compcert.png}
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   776
\end{center}
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   777
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   778
\end{frame}
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   779
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%     
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   780
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   781
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%     
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   782
\begin{frame}[c]
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   783
\frametitle{Fuzzy Testing C-Compilers}
196
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   784
608
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   785
\begin{itemize}
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   786
\item tested GCC, LLVM and others by randomly generating 
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   787
C-programs
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   788
\item found more than 300 bugs in GCC and also
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   789
many in LLVM (some of them highest-level critical)\bigskip
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   790
\item about CompCert:
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   791
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   792
\begin{bubble}[10cm]\small ``The striking thing about our CompCert
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   793
results is that the middle-end bugs we found in all other
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   794
compilers are absent. As of early 2011, the under-development
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   795
version of CompCert is the only compiler we have tested for
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   796
which Csmith cannot find wrong-code errors. This is not for
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   797
lack of trying: we have devoted about six CPU-years to the
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   798
task.'' 
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   799
\end{bubble} 
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   800
\end{itemize}
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   801
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   802
\end{frame}
3db4970ad0aa updated
Christian Urban <urbanc@in.tum.de>
parents: 601
diff changeset
   803
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%     
196
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 93
diff changeset
   804
697
370508e4d7f6 updated
Christian Urban <urbanc@in.tum.de>
parents: 608
diff changeset
   805
370508e4d7f6 updated
Christian Urban <urbanc@in.tum.de>
parents: 608
diff changeset
   806
65
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   807
\end{document}
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   808
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   809
%%% Local Variables:  
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   810
%%% mode: latex
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   811
%%% TeX-master: t
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   812
%%% End: 
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
   813