author | Christian Urban <urbanc@in.tum.de> |
Thu, 14 Nov 2019 13:50:29 +0000 | |
changeset 688 | ec181dab18e6 |
parent 687 | 8865f4f2be59 |
child 744 | 99c5916d9a8f |
permissions | -rw-r--r-- |
686 | 1 |
% !TEX program = xelatex |
63 | 2 |
\documentclass[dvipsnames,14pt,t]{beamer} |
302
0fa7b4221745
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
215
diff
changeset
|
3 |
\usepackage{../slides} |
215
828303e8e4af
updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
188
diff
changeset
|
4 |
\usepackage{../langs} |
828303e8e4af
updated slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
188
diff
changeset
|
5 |
\usepackage{../data} |
608 | 6 |
\usepackage{../graphics} |
7 |
\usepackage{../grammar} |
|
188
12ef150273ce
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
187
diff
changeset
|
8 |
|
63 | 9 |
% beamer stuff |
451 | 10 |
\renewcommand{\slidecaption}{CFL 07, King's College London} |
63 | 11 |
\newcommand{\bl}[1]{\textcolor{blue}{#1}} |
12 |
||
13 |
\begin{document} |
|
14 |
||
15 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
302
0fa7b4221745
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
215
diff
changeset
|
16 |
\begin{frame}[t] |
63 | 17 |
\frametitle{% |
18 |
\begin{tabular}{@ {}c@ {}} |
|
19 |
\\[-3mm] |
|
451 | 20 |
\LARGE Compilers and \\[-2mm] |
387
8aa406adfde0
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
374
diff
changeset
|
21 |
\LARGE Formal Languages (7)\\[3mm] |
63 | 22 |
\end{tabular}} |
23 |
||
24 |
\normalsize |
|
25 |
\begin{center} |
|
26 |
\begin{tabular}{ll} |
|
686 | 27 |
Email: & christian.urban at kcl.ac.uk\\ |
28 |
Office Hours: & Thursdays 12 -- 14\\ |
|
29 |
Location: & N7.07 (North Wing, Bush House)\\ |
|
30 |
Slides \& Progs: & KEATS (also homework is there)\\ |
|
63 | 31 |
\end{tabular} |
32 |
\end{center} |
|
33 |
||
302
0fa7b4221745
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
215
diff
changeset
|
34 |
\end{frame} |
0fa7b4221745
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
215
diff
changeset
|
35 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
63 | 36 |
|
608 | 37 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
38 |
\begin{frame}[c] |
|
39 |
\frametitle{Bird's Eye View} |
|
387
8aa406adfde0
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
374
diff
changeset
|
40 |
|
608 | 41 |
\begin{center} |
42 |
\begin{tikzpicture} |
|
43 |
\node (rexp) {\bl{\bf Lexer}}; |
|
44 |
\node (nfa) [right=of rexp] {\bl{\bf Parser}}; |
|
45 |
\node (dfa) [right=of nfa] |
|
46 |
{\bl{\begin{tabular}{c}\bf Machine Code/\\\bf Java Byte Code\end{tabular}}}; |
|
47 |
\path[->, red, line width=2mm] (rexp) edge node [above=4mm, black] {\begin{tabular}{c@{\hspace{9mm}}}token\\[-1mm] |
|
48 |
sequence\end{tabular}} (nfa); |
|
49 |
\path[->, red, line width=2mm] (nfa) edge node [above=4mm, black] {\begin{tabular}{c}parse\\[-1mm] tree\end{tabular}}(dfa); |
|
50 |
\end{tikzpicture}\\ |
|
51 |
\end{center} |
|
52 |
||
53 |
\end{frame} |
|
54 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
55 |
||
63 | 56 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
57 |
\begin{frame}[c] |
|
686 | 58 |
\frametitle{CW3} |
59 |
||
60 |
Atomic parsers for tokens |
|
61 |
||
62 |
\begin{center} |
|
63 |
\bl{$\texttt{T\_Num(123)}::rest \;\Rightarrow\; \{(\texttt{T\_Num(123)}, rest)\}$} |
|
64 |
\end{center}\bigskip |
|
65 |
||
66 |
\begin{itemize} |
|
67 |
\item you consume one or more token from the\\ |
|
68 |
input (stream) |
|
687 | 69 |
\item \bl{\texttt{T\_NUM(1), T\_OP(+), T\_NUM(2)}}\bigskip |
688 | 70 |
\item a good starting point would be \texttt{comb2.scala} |
71 |
\item in case CW2 did not work, use \texttt{toks.scala} as |
|
72 |
input to the parser |
|
686 | 73 |
\end{itemize} |
74 |
\end{frame} |
|
75 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
76 |
||
77 |
||
78 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
79 |
\begin{frame}[c] |
|
608 | 80 |
\begin{textblock}{10}(0.5,0.5) |
81 |
\LARGE |
|
82 |
\fontspec{Hoefler Text Black} |
|
83 |
\textcolor{ProcessBlue}{JVM\\ Code} |
|
84 |
\\[12mm] |
|
85 |
||
86 |
\normalsize |
|
87 |
Jasmin\\ |
|
88 |
Krakatau\\ |
|
89 |
ASM lib |
|
90 |
\end{textblock} |
|
91 |
||
387
8aa406adfde0
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
374
diff
changeset
|
92 |
|
608 | 93 |
\fontsize{8}{10}\selectfont |
94 |
%\footnotesize |
|
95 |
\mbox{}\\[-8mm]\mbox{} |
|
96 |
||
97 |
\begin{columns} |
|
98 |
\begin{column}{2cm} |
|
99 |
\lstinputlisting[numbers=none]{../progs/appHa.j} |
|
100 |
\end{column} |
|
101 |
||
102 |
\begin{column}{2cm} |
|
103 |
\lstinputlisting[numbers=none]{../progs/appHb.j} |
|
104 |
\end{column} |
|
105 |
||
106 |
\end{columns} |
|
63 | 107 |
|
608 | 108 |
\end{frame} |
109 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
110 |
||
111 |
||
112 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
113 |
\begin{frame}[t] |
|
114 |
||
63 | 115 |
\begin{center} |
608 | 116 |
\bl{\begin{tabular}{@{}lcl@{}} |
117 |
\\[-12mm] |
|
118 |
\meta{Stmt} & $::=$ & $\texttt{skip}$\\ |
|
119 |
& $|$ & \textit{Id}\;\texttt{:=}\;\meta{AExp}\\ |
|
120 |
& $|$ & \texttt{if}\; \meta{BExp} \;\texttt{then}\; \meta{Block} \;\texttt{else}\; \meta{Block}\\ |
|
121 |
& $|$ & \texttt{while}\; \meta{BExp} \;\texttt{do}\; \meta{Block}\\ |
|
122 |
& $|$ & \texttt{read}\;\textit{Id}\\ |
|
123 |
& $|$ & \texttt{write}\;\textit{Id}\\ |
|
124 |
& $|$ & \texttt{write}\;\textit{String}\medskip\\ |
|
125 |
\meta{Stmts} & $::=$ & \meta{Stmt} \;\texttt{;}\; \meta{Stmts}\\ |
|
126 |
& $|$ & \meta{Stmt}\medskip\\ |
|
127 |
\meta{Block} & $::=$ & \texttt{\{}\,\meta{Stmts}\,\texttt{\}}\\ |
|
128 |
& $|$ & \meta{Stmt}\medskip\\ |
|
129 |
\meta{AExp} & $::=$ & \ldots\\ |
|
130 |
\meta{BExp} & $::=$ & \ldots\\ |
|
131 |
\end{tabular}} |
|
184
2e9134d25a2b
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
173
diff
changeset
|
132 |
\end{center} |
608 | 133 |
\end{frame} |
134 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
184
2e9134d25a2b
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
173
diff
changeset
|
135 |
|
608 | 136 |
|
137 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
138 |
\begin{frame}[c] |
|
139 |
\frametitle{\begin{tabular}{c}Fibonacci Numbers\end{tabular}} |
|
387
8aa406adfde0
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
374
diff
changeset
|
140 |
|
608 | 141 |
\mbox{}\\[-18mm]\mbox{} |
142 |
||
143 |
{\lstset{language=While}\fontsize{10}{12}\selectfont |
|
144 |
\texttt{\lstinputlisting{../progs/fib.while}}} |
|
387
8aa406adfde0
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
374
diff
changeset
|
145 |
|
369
43c0ed473720
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
302
diff
changeset
|
146 |
\end{frame} |
184
2e9134d25a2b
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
173
diff
changeset
|
147 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
387
8aa406adfde0
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
374
diff
changeset
|
148 |
|
184
2e9134d25a2b
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
173
diff
changeset
|
149 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
387
8aa406adfde0
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
374
diff
changeset
|
150 |
\begin{frame}[c] |
608 | 151 |
\frametitle{Interpreter} |
188
12ef150273ce
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
187
diff
changeset
|
152 |
|
63 | 153 |
\begin{center} |
188
12ef150273ce
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
187
diff
changeset
|
154 |
\bl{\begin{tabular}{@{}lcl@{}} |
12ef150273ce
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
187
diff
changeset
|
155 |
$\text{eval}(n, E)$ & $\dn$ & $n$\\ |
12ef150273ce
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
187
diff
changeset
|
156 |
$\text{eval}(x, E)$ & $\dn$ & $E(x)$ \;\;\;\textcolor{black}{lookup \bl{$x$} in \bl{$E$}}\\ |
12ef150273ce
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
187
diff
changeset
|
157 |
$\text{eval}(a_1 + a_2, E)$ & $\dn$ & $\text{eval}(a_1, E) + \text{eval}(a_2, E)$\\ |
12ef150273ce
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
187
diff
changeset
|
158 |
$\text{eval}(a_1 - a_2, E)$ & $\dn$ & $\text{eval}(a_1, E) - \text{eval}(a_2, E)$\\ |
12ef150273ce
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
187
diff
changeset
|
159 |
$\text{eval}(a_1 * a_2, E)$ & $\dn$ & $\text{eval}(a_1, E) * \text{eval}(a_2, E)$\bigskip\\ |
12ef150273ce
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
187
diff
changeset
|
160 |
$\text{eval}(a_1 = a_2, E)$ & $\dn$ & $\text{eval}(a_1, E) = \text{eval}(a_2, E)$\\ |
12ef150273ce
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
187
diff
changeset
|
161 |
$\text{eval}(a_1\,!\!= a_2, E)$ & $\dn$ & $\neg(\text{eval}(a_1, E) = \text{eval}(a_2, E))$\\ |
12ef150273ce
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
187
diff
changeset
|
162 |
$\text{eval}(a_1 < a_2, E)$ & $\dn$ & $\text{eval}(a_1, E) < \text{eval}(a_2, E)$\ |
12ef150273ce
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
187
diff
changeset
|
163 |
\end{tabular}} |
63 | 164 |
\end{center} |
165 |
||
608 | 166 |
\end{frame} |
63 | 167 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
608 | 168 |
|
63 | 169 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
170 |
\begin{frame}[c] |
|
608 | 171 |
\frametitle{Interpreter (2)} |
63 | 172 |
|
173 |
\begin{center} |
|
188
12ef150273ce
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
187
diff
changeset
|
174 |
\bl{\begin{tabular}{@{}lcl@{}} |
12ef150273ce
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
187
diff
changeset
|
175 |
$\text{eval}(\text{skip}, E)$ & $\dn$ & $E$\\ |
12ef150273ce
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
187
diff
changeset
|
176 |
$\text{eval}(x:=a, E)$ & $\dn$ & \bl{$E(x \mapsto \text{eval}(a, E))$}\\ |
12ef150273ce
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
187
diff
changeset
|
177 |
\multicolumn{3}{@{}l@{}}{$\text{eval}(\text{if}\;b\;\text{then}\;cs_1\;\text{else}\;cs_2 , E) \dn$}\\ |
12ef150273ce
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
187
diff
changeset
|
178 |
\multicolumn{3}{@{}l@{}}{\hspace{2cm}$\text{if}\;\text{eval}(b,E)\;\text{then}\; |
12ef150273ce
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
187
diff
changeset
|
179 |
\text{eval}(cs_1,E)$}\\ |
12ef150273ce
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
187
diff
changeset
|
180 |
\multicolumn{3}{@{}l@{}}{\hspace{2cm}$\phantom{\text{if}\;\text{eval}(b,E)\;}\text{else}\;\text{eval}(cs_2,E)$}\\ |
12ef150273ce
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
187
diff
changeset
|
181 |
\multicolumn{3}{@{}l@{}}{$\text{eval}(\text{while}\;b\;\text{do}\;cs, E) \dn$}\\ |
12ef150273ce
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
187
diff
changeset
|
182 |
\multicolumn{3}{@{}l@{}}{\hspace{2cm}$\text{if}\;\text{eval}(b,E)$}\\ |
12ef150273ce
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
187
diff
changeset
|
183 |
\multicolumn{3}{@{}l@{}}{\hspace{2cm}$\text{then}\; |
12ef150273ce
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
187
diff
changeset
|
184 |
\text{eval}(\text{while}\;b\;\text{do}\;cs, \text{eval}(cs,E))$}\\ |
12ef150273ce
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
187
diff
changeset
|
185 |
\multicolumn{3}{@{}l@{}}{\hspace{2cm}$\text{else}\; E$}\\ |
12ef150273ce
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
187
diff
changeset
|
186 |
$\text{eval}(\text{write}\; x, E)$ & $\dn$ & $\{\;\text{println}(E(x))\; ;\;E\;\}$\\ |
63 | 187 |
\end{tabular}} |
188 |
\end{center} |
|
189 |
||
608 | 190 |
\end{frame} |
188
12ef150273ce
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
187
diff
changeset
|
191 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
12ef150273ce
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
187
diff
changeset
|
192 |
|
12ef150273ce
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
187
diff
changeset
|
193 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
12ef150273ce
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
187
diff
changeset
|
194 |
\begin{frame}[c] |
608 | 195 |
\frametitle{Test Program} |
188
12ef150273ce
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
187
diff
changeset
|
196 |
|
12ef150273ce
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
187
diff
changeset
|
197 |
\mbox{}\\[-18mm]\mbox{} |
12ef150273ce
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
187
diff
changeset
|
198 |
|
608 | 199 |
{\lstset{language=While}\fontsize{10}{12}\selectfont |
188
12ef150273ce
added
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
187
diff
changeset
|
200 |
\texttt{\lstinputlisting{../progs/loops.while}}} |
63 | 201 |
|
608 | 202 |
\end{frame} |
63 | 203 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
204 |
||
205 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
608 | 206 |
\begin{frame}[c] |
207 |
\fontsize{7}{9}\selectfont |
|
208 |
||
209 |
||
210 |
\begin{columns} |
|
211 |
\begin{column}{7cm} |
|
212 |
\lstinputlisting[numbers=none]{../progs/appHa.j} |
|
213 |
\end{column} |
|
214 |
||
215 |
\begin{column}{7cm} |
|
216 |
\lstinputlisting[numbers=none]{../progs/appHb.j} |
|
217 |
\end{column} |
|
218 |
\end{columns} |
|
219 |
||
220 |
\end{frame} |
|
221 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
222 |
||
686 | 223 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
224 |
%\begin{frame}[t] |
|
225 |
%\frametitle{Interpreted Code} |
|
226 |
% |
|
227 |
%\begin{center} |
|
228 |
%\begin{tikzpicture} |
|
229 |
%\begin{axis}[axis x line=bottom, axis y line=left, xlabel=n, ylabel=secs, legend style=small] |
|
230 |
%\addplot+[smooth] file {interpreted.data}; |
|
231 |
%\end{axis} |
|
232 |
%\end{tikzpicture} |
|
233 |
%\end{center} |
|
234 |
% |
|
235 |
%\end{frame} |
|
236 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
237 |
% |
|
238 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
239 |
%\begin{frame}[c] |
|
240 |
%\frametitle{Java Virtual Machine} |
|
241 |
% |
|
242 |
%\begin{itemize} |
|
243 |
%\item introduced in 1995 |
|
244 |
%\item is a stack-based VM (like Postscript, CLR of .Net) |
|
245 |
%\item contains a JIT compiler |
|
246 |
%\item many languages take advantage of JVM's infrastructure (JRE) |
|
247 |
%\item is garbage collected $\Rightarrow$ no buffer overflows |
|
248 |
%\item some languages compiled to the JVM: Scala, Clojure\ldots |
|
249 |
%\end{itemize} |
|
250 |
% |
|
251 |
%\end{frame} |
|
608 | 252 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
253 |
||
254 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
255 |
\begin{frame}[t,fragile] |
|
256 |
\frametitle{Compiling AExps} |
|
257 |
||
686 | 258 |
For example \textbf{\bl{1 + ((2 * 3) + (4 - 3))}}:\medskip |
608 | 259 |
|
260 |
\begin{columns}[T] |
|
261 |
\begin{column}{.3\textwidth} |
|
262 |
\begin{center} |
|
263 |
\bl{\begin{tikzpicture} |
|
264 |
\tikzset{level distance=12mm,sibling distance=4mm} |
|
265 |
\tikzset{edge from parent/.style={draw,very thick}} |
|
266 |
\Tree [.$+$ [.$1$ ] [.$+$ [.$*$ $2$ $3$ ] [.$-$ $4$ $3$ ]]] |
|
267 |
\end{tikzpicture}} |
|
268 |
\end{center} |
|
269 |
\end{column} |
|
270 |
\begin{column}{.3\textwidth} |
|
271 |
\begin{lstlisting}[language=JVMIS,numbers=none] |
|
272 |
ldc 1 |
|
273 |
ldc 2 |
|
274 |
ldc 3 |
|
275 |
imul |
|
276 |
ldc 4 |
|
277 |
ldc 3 |
|
278 |
isub |
|
279 |
iadd |
|
280 |
iadd |
|
281 |
\end{lstlisting} |
|
282 |
\end{column} |
|
283 |
\end{columns}\bigskip |
|
284 |
||
285 |
\small |
|
286 |
Traverse tree in post-order \bl{$\Rightarrow$} code for |
|
287 |
stack-machine |
|
288 |
||
289 |
\end{frame} |
|
290 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
291 |
||
292 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
293 |
\begin{frame}[t,fragile] |
|
294 |
\frametitle{Compiling AExps} |
|
295 |
||
686 | 296 |
\liningnums{\textbf{\Large\bl{(1 + 2) + 3}}} |
608 | 297 |
|
298 |
\begin{lstlisting}[language=JVMIS,numbers=none,xleftmargin=6cm] |
|
299 |
ldc 1 |
|
300 |
ldc 2 |
|
301 |
iadd |
|
302 |
ldc 3 |
|
303 |
iadd |
|
304 |
\end{lstlisting} |
|
305 |
||
306 |
||
307 |
\end{frame} |
|
308 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
309 |
||
310 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
311 |
\begin{frame}[t,fragile] |
|
312 |
\frametitle{Compiling AExps} |
|
313 |
||
314 |
\liningnums{\textbf{\Large\bl{1 + (2 + 3)}}} |
|
315 |
||
316 |
\begin{lstlisting}[language=JVMIS,numbers=none,xleftmargin=6cm] |
|
317 |
ldc 1 |
|
318 |
ldc 2 |
|
319 |
ldc 3 |
|
320 |
iadd |
|
321 |
iadd |
|
322 |
\end{lstlisting} |
|
323 |
\bigskip\pause |
|
324 |
\vfill |
|
325 |
||
326 |
\textcolor{codepurple}{\textbf{\texttt{dadd}}}, |
|
327 |
\textcolor{codepurple}{\textbf{\texttt{fadd}}}, |
|
328 |
\textcolor{codepurple}{\textbf{\texttt{ladd}}}, \ldots |
|
329 |
||
330 |
\end{frame} |
|
331 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
332 |
||
333 |
||
334 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
335 |
\begin{frame}[t] |
|
336 |
\frametitle{Compiling AExps} |
|
337 |
||
338 |
\begin{center} |
|
339 |
\bl{\begin{tabular}{@{}lcl@{}} |
|
340 |
$\text{compile}(n)$ & $\dn$ & $\text{ldc}\;n$\\ |
|
341 |
$\text{compile}(a_1 + a_2)$ & $\dn$\\ |
|
342 |
\multicolumn{3}{l}{$\qquad\text{compile}(a_1) \;@\;\text{compile}(a_2)\;@\; \text{iadd}$}\smallskip\\ |
|
343 |
$\text{compile}(a_1 - a_2)$ & $\dn$\\ |
|
344 |
\multicolumn{3}{l}{$\qquad\text{compile}(a_1) \;@\; \text{compile}(a_2)\;@\; \text{isub}$}\smallskip\\ |
|
345 |
$\text{compile}(a_1 * a_2)$ & $\dn$\\ |
|
346 |
\multicolumn{3}{l}{$\qquad\text{compile}(a_1) \;@\; \text{compile}(a_2)\;@\; \text{imul}$}\smallskip\\ |
|
347 |
\end{tabular}} |
|
348 |
\end{center} |
|
349 |
||
350 |
\end{frame} |
|
351 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
352 |
||
353 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
354 |
\begin{frame}[t,fragile] |
|
355 |
\frametitle{\begin{tabular}{c}Compiling AExps\end{tabular}} |
|
356 |
||
357 |
\liningnums{\textbf{\Large\bl{1 $+$ 2 $*$ 3 $+$ (4 $-$ 3)}}} |
|
358 |
||
359 |
\begin{lstlisting}[language=JVMIS,numbers=none,xleftmargin=6cm] |
|
360 |
ldc 1 |
|
361 |
ldc 2 |
|
362 |
ldc 3 |
|
363 |
imul |
|
364 |
ldc 4 |
|
365 |
ldc 3 |
|
366 |
isub |
|
367 |
iadd |
|
368 |
iadd |
|
369 |
\end{lstlisting} |
|
370 |
||
371 |
\end{frame} |
|
372 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
373 |
||
374 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
375 |
\begin{frame}[c] |
|
376 |
\frametitle{Variables} |
|
377 |
\liningnums{\textbf{\Large\bl{x $:=$ 5 $+$ y $*$ 2}}}\bigskip\pause |
|
378 |
||
379 |
\begin{itemize} |
|
380 |
\item lookup: \bl{$\textcolor{codepurple}{\textbf{\texttt{iload}}}\; index$} |
|
381 |
\item store: \bl{$\textcolor{codepurple}{\textbf{\texttt{istore}}}\; index$} |
|
382 |
\end{itemize}\bigskip\pause |
|
383 |
||
384 |
while compilating we have to maintain a map between our identifiers and the |
|
385 |
Java bytecode indices |
|
386 |
||
387 |
\begin{center} |
|
388 |
\bl{$\text{compile}(a, E)$} |
|
389 |
\end{center} |
|
390 |
||
391 |
\end{frame} |
|
392 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
393 |
||
394 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
395 |
\begin{frame}[t] |
|
396 |
\frametitle{Compiling AExps} |
|
397 |
||
398 |
\begin{center} |
|
399 |
\bl{\begin{tabular}{@{}lcl@{}} |
|
400 |
$\text{compile}(n, E)$ & $\dn$ & $\text{ldc}\;n$\\ |
|
401 |
$\text{compile}(a_1 + a_2, E)$ & $\dn$\\ |
|
402 |
\multicolumn{3}{l}{$\qquad\text{compile}(a_1, E) \;@\;\text{compile}(a_2, E)\;@\; \text{iadd}$}\smallskip\\ |
|
403 |
$\text{compile}(a_1 - a_2, E)$ & $\dn$\\ |
|
404 |
\multicolumn{3}{l}{$\qquad\text{compile}(a_1, E) \;@\; \text{compile}(a_2, E)\;@\; \text{isub}$}\smallskip\\ |
|
405 |
$\text{compile}(a_1 * a_2, E)$ & $\dn$\\ |
|
406 |
\multicolumn{3}{l}{$\qquad\text{compile}(a_1, E) \;@\; \text{compile}(a_2, E)\;@\; \text{imul}$}\bigskip\\ |
|
407 |
$\text{compile}(x, E)$ & $\dn$ & $\text{iload}\;E(x)$\\ |
|
408 |
\end{tabular}} |
|
409 |
\end{center} |
|
410 |
||
411 |
\end{frame} |
|
412 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
413 |
||
414 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
415 |
\begin{frame}[c, fragile] |
|
416 |
\frametitle{Mathematical Functions} |
|
417 |
||
418 |
Compilation of some mathematical functions: |
|
419 |
||
420 |
\begin{center} |
|
421 |
\begin{tabular}{lcl} |
|
422 |
\texttt{Aop("+", a1, a2)} & $\Rightarrow$ & \texttt{...iadd}\\ |
|
423 |
\texttt{Aop("-", a1, a2)} & $\Rightarrow$ & \texttt{...isub}\\ |
|
424 |
\texttt{Aop("*", a1, a2)} & $\Rightarrow$ & \texttt{...imul}\\ |
|
425 |
\texttt{Aop("/", a1, a2)} & $\Rightarrow$ & \texttt{...idiv}\\ |
|
426 |
\texttt{Aop("\%", a1, a2)} & $\Rightarrow$ & \texttt{...irem}\\ |
|
427 |
\end{tabular} |
|
428 |
\end{center} |
|
429 |
||
430 |
\end{frame} |
|
431 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
432 |
||
433 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
434 |
\begin{frame}[c] |
|
435 |
\frametitle{Compiling Statements} |
|
436 |
||
437 |
We return a list of instructions and an environment for the |
|
438 |
variables |
|
439 |
||
440 |
\begin{center} |
|
441 |
\bl{\begin{tabular}{@{}l@{\hspace{1mm}}c@{\hspace{1mm}}l@{}} |
|
442 |
$\text{compile}(\text{skip}, E)$ & $\dn$ & $(\textit{Nil}, E)$\bigskip\\ |
|
443 |
$\text{compile}(x := a, E)$ & $\dn$\\ |
|
444 |
\multicolumn{3}{l}{$(\text{compile}(a, E) \;@\;\text{istore}\;index, E(x\mapsto index))$}\\ |
|
445 |
\end{tabular}} |
|
446 |
\end{center}\medskip |
|
447 |
||
448 |
where \bl{$index$} is \bl{$E(x)$} if it is already defined, |
|
449 |
or if it is not, then the largest index not yet seen |
|
450 |
||
451 |
\end{frame} |
|
452 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
453 |
||
454 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
455 |
\begin{frame}[c,fragile] |
|
456 |
\frametitle{Compiling Assignments} |
|
457 |
||
458 |
\liningnums{\textbf{\Large\bl{x $:=$ x $+$ 1}}} |
|
459 |
||
460 |
\begin{lstlisting}[language=JVMIS,numbers=none,xleftmargin=6cm] |
|
461 |
iload /*@\bl{$n_x$}@*/ |
|
462 |
ldc 1 |
|
463 |
iadd |
|
464 |
istore /*@\bl{$n_x$}@*/ |
|
465 |
\end{lstlisting}\medskip |
|
466 |
||
467 |
where \bl{$n_x$} is the index corresponding to the variable~\bl{$x$} |
|
468 |
||
469 |
\end{frame} |
|
470 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
471 |
||
472 |
||
473 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
474 |
\begin{frame}[t] |
|
475 |
\frametitle{Compiling Ifs} |
|
476 |
||
477 |
{\Large\bl{$\text{if}\;b\;\text{then}\;cs_1\;\text{else}\;cs_2$}}\bigskip\bigskip |
|
478 |
||
479 |
\onslide<2->{Case }\only<2>{{\bf True}:}\only<3>{{\bf False}:} |
|
480 |
||
481 |
\begin{center} |
|
482 |
\begin{tikzpicture}[node distance=2mm and 4mm, |
|
483 |
block/.style={rectangle, minimum size=1cm, draw=black, line width=1mm}, |
|
484 |
point/.style={rectangle, inner sep=0mm, minimum size=0mm, fill=red}, |
|
485 |
skip loop/.style={red, line width=1mm, to path={-- ++(0,-10mm) -| (\tikztotarget)}}] |
|
486 |
\node (A1) [point] {}; |
|
487 |
\node (b) [block, right=of A1] {code of \bl{$b$}}; |
|
488 |
\node (A2) [point, right=of b] {}; |
|
489 |
\node (cs1) [block, right=of A2] {code of \bl{$cs_1$}}; |
|
490 |
\node (A3) [point, right=of cs1] {}; |
|
491 |
\node (cs2) [block, right=of A3] {code of \bl{$cs_2$}}; |
|
492 |
\node (A4) [point, right=of cs2] {}; |
|
493 |
||
494 |
\only<2>{ |
|
495 |
\draw (A1) edge [->, red, line width=1mm] (b); |
|
496 |
\draw (b) edge [->, red, line width=1mm] (cs1); |
|
497 |
\draw (cs1) edge [->, red, line width=1mm] (A3); |
|
498 |
\draw (A3) edge [->,skip loop] (A4); |
|
499 |
\node [below=of cs2] {\raisebox{-5mm}{\small{}jump}};} |
|
500 |
\only<3>{ |
|
501 |
\draw (A1) edge [->, red, line width=1mm] (b); |
|
502 |
\draw (b) edge [->, red, line width=1mm] (A2); |
|
503 |
\draw (A2) edge [skip loop] (A3); |
|
504 |
\draw (A3) edge [->, red, line width=1mm] (cs2); |
|
505 |
\draw (cs2) edge [->,red, line width=1mm] (A4); |
|
506 |
\node [below=of cs1] {\raisebox{-5mm}{\small{}conditional jump}};} |
|
507 |
\end{tikzpicture} |
|
508 |
\end{center} |
|
509 |
||
510 |
\end{frame} |
|
511 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
512 |
||
513 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
514 |
\begin{frame}[t,fragile] |
|
515 |
\frametitle{Conditional Jumps} |
|
516 |
||
517 |
\begin{minipage}{1.1\textwidth} |
|
518 |
\begin{itemize} |
|
519 |
\item \textcolor{codepurple}{\textbf{\texttt{if\_icmpeq}}} \bl{$label$} |
|
520 |
if two ints are equal, then jump\medskip |
|
521 |
\item \textcolor{codepurple}{\textbf{\texttt{if\_icmpne}}} \bl{$label$} |
|
522 |
if two ints aren't equal, then jump\medskip |
|
523 |
\item \textcolor{codepurple}{\textbf{\texttt{if\_icmpge}}} \bl{$label$} |
|
524 |
if one int is greater or equal then another, then jump |
|
525 |
\item[]\ldots |
|
526 |
\end{itemize} |
|
527 |
\end{minipage}\pause |
|
528 |
||
529 |
\begin{lstlisting}[language=JVMIS,numbers=none,xleftmargin=2cm] |
|
530 |
/*@\bl{$L_1$:}@*/ |
|
531 |
if_icmpeq /*@\bl{$L_2$}@*/ |
|
532 |
iload 1 |
|
533 |
ldc 1 |
|
534 |
iadd |
|
535 |
if_icmpeq /*@\bl{$L_1$}@*/ |
|
536 |
/*@\bl{$L_2$:}@*/ |
|
537 |
\end{lstlisting} |
|
538 |
||
539 |
||
540 |
\begin{textblock}{3.5}(11,12) |
|
541 |
\only<3>{labels must be unique} |
|
542 |
\end{textblock} |
|
543 |
\end{frame} |
|
544 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
545 |
||
546 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
547 |
\begin{frame}[c,fragile] |
|
548 |
\frametitle{Compiling Ifs} |
|
549 |
||
550 |
For example |
|
551 |
||
552 |
\begin{lstlisting}[mathescape,numbers=none,language=While] |
|
553 |
if 1 = 1 then x := 2 else y := 3 |
|
554 |
\end{lstlisting} |
|
555 |
||
556 |
||
557 |
\begin{center} |
|
558 |
\begin{lstlisting}[mathescape,language=JVMIS,numbers=none] |
|
559 |
ldc 1 |
|
560 |
ldc 1 |
|
561 |
if_icmpne L_ifelse $\quad\tikz[remember picture] \node (C) {\mbox{}};$ |
|
562 |
ldc 2 |
|
563 |
istore 0 |
|
564 |
goto L_ifend $\quad\tikz[remember picture] \node (A) {\mbox{}};$ |
|
565 |
L_ifelse: $\quad\tikz[remember picture] \node[] (D) {\mbox{}};$ |
|
566 |
ldc 3 |
|
567 |
istore 1 |
|
568 |
L_ifend: $\quad\tikz[remember picture] \node[] (B) {\mbox{}};$ |
|
569 |
\end{lstlisting} |
|
570 |
\end{center} |
|
571 |
||
572 |
\begin{tikzpicture}[remember picture,overlay] |
|
573 |
\draw[->,very thick] (A) edge [->,to path={-- ++(10mm,0mm) |
|
574 |
-- ++(0mm,-17.3mm) |- (\tikztotarget)},line width=1mm] (B.east); |
|
575 |
\draw[->,very thick] (C) edge [->,to path={-- ++(10mm,0mm) |
|
576 |
-- ++(0mm,-17.3mm) |- (\tikztotarget)},line width=1mm] (D.east); |
|
577 |
\end{tikzpicture} |
|
578 |
||
579 |
\end{frame} |
|
580 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
581 |
||
582 |
||
583 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
584 |
\begin{frame}[t] |
|
585 |
\frametitle{Compiling BExps} |
|
586 |
||
587 |
{\Large\bl{$a_1 = a_2$}} |
|
588 |
||
589 |
\begin{center} |
|
590 |
\bl{\begin{tabular}{lcl} |
|
591 |
$\text{compile}(a_1 = a_2, E, lab)$ & $\dn$\\ |
|
592 |
\multicolumn{3}{l}{$\quad\text{compile}(a_1, E) \;@\;\text{compile}(a_2, E)\;@\; \text{if\_icmpne}\;lab$} |
|
593 |
\end{tabular}} |
|
594 |
\end{center} |
|
595 |
||
596 |
\end{frame} |
|
597 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
598 |
||
599 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
600 |
\begin{frame}[c, fragile] |
|
601 |
\frametitle{Boolean Expressions} |
|
602 |
||
603 |
Compilation of boolean expressions: |
|
604 |
||
605 |
\begin{center} |
|
606 |
\begin{tikzpicture}[node distance=2mm and 4mm, |
|
607 |
block/.style={rectangle, minimum size=1cm, draw=black, line width=1mm}, |
|
608 |
point/.style={rectangle, inner sep=0mm, minimum size=0mm, fill=red}, |
|
609 |
skip loop/.style={red, line width=1mm, to path={-- ++(0,-10mm) -| (\tikztotarget)}}] |
|
610 |
\node (A1) [point] {}; |
|
611 |
\node (b) [block, right=of A1] {code of \bl{$b$}}; |
|
612 |
\node (A2) [point, right=of b] {}; |
|
613 |
\node (cs1) [block, right=of A2] {code of \bl{$cs_1$}}; |
|
614 |
\node (A3) [point, right=of cs1] {}; |
|
615 |
\node (cs2) [block, right=of A3] {code of \bl{$cs_2$}}; |
|
616 |
\node (A4) [point, right=of cs2] {}; |
|
617 |
||
618 |
\only<1>{ |
|
619 |
\draw (A1) edge [->, red, line width=1mm] (b); |
|
620 |
\draw (b) edge [->, red, line width=1mm] (A2); |
|
621 |
\draw (A2) edge [skip loop] (A3); |
|
622 |
\draw (A3) edge [->, red, line width=1mm] (cs2); |
|
623 |
\draw (cs2) edge [->,red, line width=1mm] (A4); |
|
624 |
\node [below=of cs1] {\raisebox{-5mm}{\small{}conditional jump}};} |
|
625 |
\end{tikzpicture} |
|
626 |
\end{center} |
|
627 |
||
628 |
\begin{center} |
|
629 |
\begin{tabular}{lcl} |
|
630 |
\texttt{Bop("==", a1, a2)} & $\Rightarrow$ & \texttt{...if\_icmpne...}\\ |
|
631 |
\texttt{Bop("!=", a1, a2)} & $\Rightarrow$ & \texttt{...if\_icmpeq...}\\ |
|
632 |
\texttt{Bop("<", a1, a2)} & $\Rightarrow$ & \texttt{...if\_icmpge...}\\ |
|
633 |
\texttt{Bop("<=", a1, a2)} & $\Rightarrow$ & \texttt{...if\_icmpgt...}\\ |
|
634 |
\end{tabular} |
|
635 |
\end{center} |
|
636 |
||
637 |
\end{frame} |
|
638 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
639 |
||
640 |
||
641 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
642 |
\begin{frame}[t] |
|
643 |
\frametitle{Compiling Ifs} |
|
644 |
||
645 |
{\Large\bl{if $b$ then $cs_1$ else $cs_2$}} |
|
646 |
||
647 |
\begin{center} |
|
648 |
\bl{\begin{tabular}{lcl} |
|
649 |
$\text{compile}(\text{if}\;b\;\text{then}\; cs_1\;\text{else}\; cs_2, E)$ & $\dn$\\ |
|
650 |
\multicolumn{3}{l}{$\quad l_{ifelse}\;$ \textcolor{black}{(fresh label)}}\\ |
|
651 |
\multicolumn{3}{l}{$\quad l_{ifend}\;$ \textcolor{black}{(fresh label)}}\\ |
|
652 |
\multicolumn{3}{l}{$\quad (is_1, E') = \text{compile}(cs_1, E)$}\\ |
|
653 |
\multicolumn{3}{l}{$\quad (is_2, E'') = \text{compile}(cs_2, E')$}\\ |
|
654 |
\multicolumn{3}{l}{$\quad(\text{compile}(b, E, l_{ifelse})$}\\ |
|
655 |
\multicolumn{3}{l}{$\quad\phantom{(}@\;is_1$}\\ |
|
656 |
\multicolumn{3}{l}{$\quad\phantom{(}@\; \text{goto}\;l_{ifend}$}\\ |
|
657 |
\multicolumn{3}{l}{$\quad\phantom{(}@\;l_{ifelse}:$}\\ |
|
658 |
\multicolumn{3}{l}{$\quad\phantom{(}@\;is_2$}\\ |
|
659 |
\multicolumn{3}{l}{$\quad\phantom{(}@\;l_{ifend}:, E'')$}\\ |
|
660 |
\end{tabular}} |
|
661 |
\end{center} |
|
662 |
||
663 |
\end{frame} |
|
664 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
665 |
||
666 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
667 |
\begin{frame}[t] |
|
668 |
\frametitle{Compiling Whiles} |
|
669 |
||
670 |
{\Large\bl{$\text{while}\;b\;\text{do}\;cs$}}\bigskip\bigskip |
|
671 |
||
672 |
\onslide<2->{Case }\only<2>{{\bf True}:}\only<3>{{\bf False}:} |
|
673 |
||
674 |
\begin{center} |
|
675 |
\begin{tikzpicture}[node distance=2mm and 4mm, |
|
676 |
block/.style={rectangle, minimum size=1cm, draw=black, line width=1mm}, |
|
677 |
point/.style={rectangle, inner sep=0mm, minimum size=0mm, fill=red}, |
|
678 |
skip loop/.style={red, line width=1mm, to path={-- ++(0,-10mm) -| (\tikztotarget)}}] |
|
679 |
\node (A0) [point, left=of A1] {}; |
|
680 |
\node (A1) [point] {}; |
|
681 |
\node (b) [block, right=of A1] {code of \bl{$b$}}; |
|
682 |
\node (A2) [point, right=of b] {}; |
|
683 |
\node (cs1) [block, right=of A2] {code of \bl{$cs$}}; |
|
684 |
\node (A3) [point, right=of cs1] {}; |
|
685 |
\node (A4) [point, right=of A3] {}; |
|
686 |
||
687 |
\only<2>{ |
|
688 |
\draw (A0) edge [->, red, line width=1mm] (b); |
|
689 |
\draw (b) edge [->, red, line width=1mm] (cs1); |
|
690 |
\draw (cs1) edge [->, red, line width=1mm] (A3); |
|
691 |
\draw (A3) edge [->,skip loop] (A1);} |
|
692 |
\only<3>{ |
|
693 |
\draw (A0) edge [->, red, line width=1mm] (b); |
|
694 |
\draw (b) edge [->, red, line width=1mm] (A2); |
|
695 |
\draw (A2) edge [skip loop] (A3); |
|
696 |
\draw (A3) edge [->, red, line width=1mm] (A4);} |
|
697 |
\end{tikzpicture} |
|
698 |
\end{center} |
|
699 |
||
700 |
\end{frame} |
|
701 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
702 |
||
703 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
704 |
\begin{frame}[t] |
|
705 |
\frametitle{Compiling Whiles} |
|
706 |
||
707 |
{\Large\bl{while $b$ do $cs$}} |
|
708 |
||
709 |
\begin{center} |
|
710 |
\bl{\begin{tabular}{lcl} |
|
711 |
$\text{compile}(\text{while}\; b\; \text{do} \;cs, E)$ & $\dn$\\ |
|
712 |
\multicolumn{3}{l}{$\quad l_{wbegin}\;$ \textcolor{black}{(fresh label)}}\\ |
|
713 |
\multicolumn{3}{l}{$\quad l_{wend}\;$ \textcolor{black}{(fresh label)}}\\ |
|
714 |
\multicolumn{3}{l}{$\quad (is, E') = \text{compile}(cs_1, E)$}\\ |
|
715 |
\multicolumn{3}{l}{$\quad(l_{wbegin}:$}\\ |
|
716 |
\multicolumn{3}{l}{$\quad\phantom{(}@\;\text{compile}(b, E, l_{wend})$}\\ |
|
717 |
\multicolumn{3}{l}{$\quad\phantom{(}@\;is$}\\ |
|
718 |
\multicolumn{3}{l}{$\quad\phantom{(}@\; \text{goto}\;l_{wbegin}$}\\ |
|
719 |
\multicolumn{3}{l}{$\quad\phantom{(}@\;l_{wend}:, E')$}\\ |
|
720 |
\end{tabular}} |
|
721 |
\end{center} |
|
722 |
||
723 |
\end{frame} |
|
724 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
725 |
||
726 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
727 |
\begin{frame}[c,fragile] |
|
728 |
\frametitle{Compiling Whiles} |
|
729 |
||
730 |
For example |
|
731 |
||
732 |
\begin{lstlisting}[mathescape,numbers=none,language=While] |
|
733 |
while x <= 10 do x := x + 1 |
|
734 |
\end{lstlisting} |
|
735 |
||
736 |
||
737 |
\begin{center} |
|
738 |
\begin{lstlisting}[mathescape,language=JVMIS,numbers=none] |
|
739 |
L_wbegin: $\quad\tikz[remember picture] \node[] (LB) {\mbox{}};$ |
|
740 |
iload 0 |
|
741 |
ldc 10 |
|
742 |
if_icmpgt L_wend $\quad\tikz[remember picture] \node (LC) {\mbox{}};$ |
|
743 |
iload 0 |
|
744 |
ldc 1 |
|
745 |
iadd |
|
746 |
istore 0 |
|
747 |
goto L_wbegin $\quad\tikz[remember picture] \node (LA) {\mbox{}};$ |
|
748 |
L_wend: $\quad\tikz[remember picture] \node[] (LD) {\mbox{}};$ |
|
749 |
\end{lstlisting} |
|
750 |
\end{center} |
|
751 |
||
752 |
\begin{tikzpicture}[remember picture,overlay] |
|
753 |
\draw[->,very thick] (LA) edge [->,to path={-- ++(12mm,0mm) |
|
754 |
-- ++(0mm,17.3mm) |- (\tikztotarget)},line width=1mm] (LB.east); |
|
755 |
\draw[->,very thick] (LC) edge [->,to path={-- ++(12mm,0mm) |
|
756 |
-- ++(0mm,-17.3mm) |- (\tikztotarget)},line width=1mm] (LD.east); |
|
757 |
\end{tikzpicture} |
|
758 |
||
759 |
\end{frame} |
|
760 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
761 |
||
762 |
||
763 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
764 |
\begin{frame}[c,fragile] |
|
765 |
\frametitle{Compiling Writes} |
|
766 |
||
767 |
\small |
|
768 |
\begin{lstlisting}[language=JVMIS,mathescape, |
|
769 |
numbers=none,xleftmargin=-6mm] |
|
770 |
.method public static write(I)V |
|
771 |
.limit locals 1 |
|
772 |
.limit stack 2 |
|
773 |
getstatic java/lang/System/out |
|
774 |
Ljava/io/PrintStream; |
|
775 |
iload 0 |
|
776 |
invokevirtual java/io/PrintStream/println(I)V |
|
777 |
return |
|
778 |
.end method |
|
779 |
||
780 |
||
781 |
||
782 |
iload $E(x)$ |
|
783 |
invokestatic XXX/XXX/write(I)V |
|
784 |
\end{lstlisting} |
|
785 |
||
786 |
\end{frame} |
|
787 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
788 |
||
789 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
790 |
\begin{frame}[c,fragile] |
|
791 |
\frametitle{Compiling Main} |
|
792 |
||
793 |
\footnotesize |
|
794 |
\begin{lstlisting}[language=JVMIS,mathescape, |
|
795 |
numbers=none,xleftmargin=-6mm] |
|
796 |
.class public XXX.XXX |
|
797 |
.super java/lang/Object |
|
798 |
||
799 |
.method public <init>()V |
|
800 |
aload_0 |
|
801 |
invokenonvirtual java/lang/Object/<init>()V |
|
802 |
return |
|
803 |
.end method |
|
804 |
||
805 |
.method public static main([Ljava/lang/String;)V |
|
806 |
.limit locals 200 |
|
807 |
.limit stack 200 |
|
808 |
||
809 |
$\textit{\ldots{}here comes the compiled code\ldots}$ |
|
810 |
||
811 |
return |
|
812 |
.end method |
|
813 |
\end{lstlisting} |
|
814 |
||
815 |
\end{frame} |
|
816 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
817 |
||
818 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
819 |
\begin{frame}[c] |
|
686 | 820 |
\frametitle{Next Compiler Phases} |
608 | 821 |
|
822 |
\begin{itemize} |
|
823 |
\item assembly $\Rightarrow$ byte code (class file) |
|
824 |
\item labels $\Rightarrow$ absolute or relative jumps\bigskip\bigskip |
|
825 |
\item \texttt{javap} is a disassembler for class files |
|
686 | 826 |
\item jasmin and krakatau are assemblers for jvm code |
369
43c0ed473720
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
302
diff
changeset
|
827 |
\end{itemize} |
43c0ed473720
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
302
diff
changeset
|
828 |
|
686 | 829 |
\end{frame} |
608 | 830 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
831 |
||
832 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
833 |
\begin{frame}[t] |
|
686 | 834 |
\frametitle{Recall: Interpreted Code} |
835 |
||
836 |
\begin{center} |
|
837 |
\begin{tikzpicture} |
|
838 |
\begin{axis}[axis x line=bottom, axis y line=left, xlabel=n, ylabel=secs, legend style=small] |
|
839 |
\addplot+[smooth] file {interpreted.data}; |
|
840 |
\end{axis} |
|
841 |
\end{tikzpicture} |
|
842 |
\end{center} |
|
843 |
||
844 |
Loop program |
|
845 |
\end{frame} |
|
846 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
847 |
||
848 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
849 |
\begin{frame}[t] |
|
850 |
\frametitle{Compiled Code} |
|
608 | 851 |
|
852 |
\begin{center} |
|
853 |
\begin{tikzpicture} |
|
854 |
\begin{axis}[axis x line=bottom, axis y line=left, xlabel=n, ylabel=secs, legend style=small] |
|
855 |
\addplot+[smooth] file {compiled.data}; |
|
856 |
\end{axis} |
|
857 |
\end{tikzpicture} |
|
858 |
\end{center} |
|
859 |
||
686 | 860 |
\end{frame} |
608 | 861 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
862 |
||
863 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
864 |
\begin{frame}[t] |
|
686 | 865 |
\frametitle{Compiler vs.~Interpreter} |
608 | 866 |
|
867 |
\begin{center} |
|
868 |
\begin{tikzpicture} |
|
869 |
\begin{axis}[axis x line=bottom, axis y line=left, ylabel=secs, |
|
870 |
xlabel=n, |
|
871 |
enlargelimits=0.05, |
|
872 |
ybar interval=0.7, legend style=small] |
|
873 |
\addplot file {interpreted2.data}; |
|
874 |
\addplot file {compiled2.data}; |
|
875 |
%\legend{interpreted, compiled} |
|
876 |
\end{axis} |
|
877 |
\end{tikzpicture} |
|
878 |
\end{center} |
|
879 |
||
686 | 880 |
\end{frame} |
608 | 881 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
882 |
||
883 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
686 | 884 |
\begin{frame}[c] |
885 |
\frametitle{A ``Compiler'' for BF*** to C} |
|
886 |
||
887 |
\begin{center} |
|
888 |
\begin{tabular}{lcl} |
|
889 |
\bl{\texttt{>}} & $\Rightarrow$ & \texttt{ptr++}\\ |
|
890 |
\bl{\texttt{<}} & $\Rightarrow$ & \texttt{ptr--}\\ |
|
891 |
\bl{\texttt{+}} & $\Rightarrow$ & \texttt{(*ptr)++}\\ |
|
892 |
\bl{\texttt{-}} & $\Rightarrow$ & \texttt{(*ptr)--}\\ |
|
893 |
\bl{\texttt{.}} & $\Rightarrow$ & \texttt{putchar(*ptr)}\\ |
|
894 |
\bl{\texttt{,}} & $\Rightarrow$ & \texttt{*ptr = getchar()}\\ |
|
895 |
\bl{\texttt{[}} & $\Rightarrow$ & \texttt{while(*ptr)\{}\\ |
|
896 |
\bl{\texttt{]}} & $\Rightarrow$ & \texttt{\}}\medskip\\ |
|
897 |
& $\Rightarrow$ & ignore everything else\\ |
|
898 |
\end{tabular} |
|
899 |
\end{center}\bigskip |
|
900 |
||
901 |
\texttt{char field[30000]\\ char *ptr = \&field[15000]} |
|
902 |
||
903 |
\end{frame} |
|
904 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
905 |
||
906 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
907 |
\begin{frame}[c,fragile] |
|
908 |
\frametitle{BF***} |
|
909 |
||
910 |
we need some big array, say \texttt{arr} and 7 (8) instructions:\medskip |
|
911 |
||
912 |
\begin{itemize} |
|
913 |
\item \texttt{>} move \texttt{ptr++} |
|
914 |
\item \texttt{<} move \texttt{ptr-{}-} |
|
915 |
\item \texttt{+} add \texttt{arr[ptr]++} |
|
916 |
\item \texttt{-} subtract \texttt{arr[ptr]-{}-} |
|
917 |
\item \texttt{.} print out \texttt{arr[ptr]} as ASCII |
|
918 |
\item \texttt{[} if \texttt{arr[ptr] == 0} jump just after the corresponding \texttt{]}; otherwise \texttt{ptr++} |
|
919 |
\item \texttt{]} if \texttt{arr[ptr] != 0} jump just after the corresponding \texttt{[}; otherwise \texttt{ptr++} |
|
920 |
||
921 |
\end{itemize} |
|
922 |
||
923 |
\end{frame} |
|
924 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
925 |
||
926 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
927 |
\begin{frame}[c,fragile] |
|
928 |
\frametitle{Arrays in While} |
|
929 |
||
930 |
\begin{itemize} |
|
931 |
\item \texttt{new arr[15000]}\medskip |
|
932 |
\item \texttt{x := 3 + arr[3 + y]}\medskip |
|
933 |
\item \texttt{arr[42 * n] := ...} |
|
934 |
\end{itemize} |
|
935 |
||
936 |
\end{frame} |
|
937 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
938 |
||
939 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
940 |
\begin{frame}[c,fragile] |
|
941 |
\frametitle{New Arrays} |
|
942 |
||
943 |
\begin{lstlisting}[mathescape,numbers=none,language=While] |
|
944 |
new arr[number] |
|
945 |
\end{lstlisting}\bigskip\bigskip |
|
946 |
||
947 |
\begin{lstlisting}[mathescape,numbers=none,language=JVMIS] |
|
948 |
ldc number |
|
949 |
newarray int |
|
950 |
astore loc_var |
|
951 |
\end{lstlisting} |
|
952 |
||
953 |
||
954 |
\end{frame} |
|
955 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
956 |
||
957 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
958 |
\begin{frame}[c,fragile] |
|
959 |
\frametitle{Array Update} |
|
960 |
||
961 |
\begin{lstlisting}[mathescape,numbers=none,language=While] |
|
962 |
arr[...] := |
|
963 |
\end{lstlisting}\bigskip\bigskip |
|
964 |
||
965 |
\begin{lstlisting}[mathescape,numbers=none,language=JVMIS] |
|
966 |
aload loc_var |
|
967 |
index_aexp |
|
968 |
value_aexp |
|
969 |
iastore |
|
970 |
\end{lstlisting} |
|
971 |
||
972 |
||
973 |
\end{frame} |
|
974 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
975 |
||
976 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
977 |
\begin{frame}[c,fragile] |
|
978 |
\frametitle{Array Lookup in AExp} |
|
979 |
||
980 |
\begin{lstlisting}[mathescape,numbers=none,language=While] |
|
981 |
...arr[...]... |
|
982 |
\end{lstlisting}\bigskip\bigskip |
|
983 |
||
984 |
\begin{lstlisting}[mathescape,numbers=none,language=JVMIS] |
|
985 |
aload loc_var |
|
986 |
index_aexp |
|
987 |
iaload |
|
988 |
\end{lstlisting} |
|
989 |
||
990 |
||
991 |
\end{frame} |
|
992 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
993 |
||
994 |
||
995 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
608 | 996 |
\mode<presentation>{ |
997 |
\begin{frame}[c] |
|
998 |
\frametitle{Backend} |
|
999 |
||
1000 |
\begin{center} |
|
1001 |
\begin{tikzpicture} |
|
1002 |
\node (rexp) {\bl{\bf Lexer}}; |
|
1003 |
\node (nfa) [right=of rexp] {\bl{\bf Parser}}; |
|
1004 |
\node (dfa) [right=of nfa] {\bl{\begin{tabular}{c}\bf Optimizations\end{tabular}}}; |
|
1005 |
\path[->, red, line width=2mm] (rexp) edge node [above=4mm, black] {\begin{tabular}{c@{\hspace{9mm}}}token\\[-1mm] |
|
1006 |
sequence\end{tabular}} (nfa); |
|
1007 |
\node (final) [below=of dfa] {\bl{\begin{tabular}{c}\bf Machine Code/\\\bf Byte Code\end{tabular}}}; |
|
1008 |
\path[->, red, line width=2mm] (nfa) edge node [above=4mm, black] {\begin{tabular}{c}parse\\[-1mm] tree |
|
1009 |
\end{tabular}}(dfa); |
|
1010 |
\path[->, red, line width=2mm] (dfa) edge (final); |
|
1011 |
\end{tikzpicture}\\ |
|
1012 |
\end{center} |
|
1013 |
||
1014 |
\end{frame}} |
|
369
43c0ed473720
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
302
diff
changeset
|
1015 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
43c0ed473720
updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
302
diff
changeset
|
1016 |
|
608 | 1017 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
1018 |
\mode<presentation>{ |
|
1019 |
\begin{frame}[t] |
|
1020 |
\frametitle{\begin{tabular}{c}What is Next\end{tabular}} |
|
1021 |
||
1022 |
\begin{itemize} |
|
1023 |
\item register spilling |
|
1024 |
\item dead code removal |
|
1025 |
\item loop optimisations |
|
1026 |
\item instruction selection |
|
1027 |
\item type checking |
|
1028 |
\item concurrency |
|
1029 |
\item fuzzy testing |
|
1030 |
\item verification\bigskip\\ |
|
1031 |
||
1032 |
\item GCC, LLVM, tracing JITs |
|
1033 |
\end{itemize} |
|
1034 |
||
1035 |
\end{frame}} |
|
1036 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
1037 |
||
184
2e9134d25a2b
added slides
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
173
diff
changeset
|
1038 |
|
63 | 1039 |
\end{document} |
1040 |
||
1041 |
%%% Local Variables: |
|
1042 |
%%% mode: latex |
|
1043 |
%%% TeX-master: t |
|
1044 |
%%% End: |
|
1045 |