slides/slides07.tex
changeset 370 a65767fe5d71
parent 369 43c0ed473720
child 372 d6af4b1239de
equal deleted inserted replaced
369:43c0ed473720 370:a65767fe5d71
   279 \end{frame}}
   279 \end{frame}}
   280 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
   280 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
   281 
   281 
   282 
   282 
   283 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   283 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   284 \mode<presentation>{
   284 \begin{frame}[t]
   285 \begin{frame}[t]
   285 \frametitle{Compiling AExps}
   286 \frametitle{\begin{tabular}{c}Compiling AExps\end{tabular}}
       
   287 
   286 
   288 \begin{center}
   287 \begin{center}
   289 \bl{\begin{tabular}{@{}lcl@{}}
   288 \bl{\begin{tabular}{@{}lcl@{}}
   290 $\text{compile}(n)$ & $\dn$ & $\text{ldc}\;n$\\
   289 $\text{compile}(n)$ & $\dn$ & $\text{ldc}\;n$\\
   291 $\text{compile}(a_1 + a_2)$ & $\dn$\\ 
   290 $\text{compile}(a_1 + a_2)$ & $\dn$\\ 
   293 $\text{compile}(a_1 - a_2)$ & $\dn$\\ 
   292 $\text{compile}(a_1 - a_2)$ & $\dn$\\ 
   294 \multicolumn{3}{l}{$\qquad\text{compile}(a_1) \;@\; \text{compile}(a_2)\;@\; \text{isub}$}\smallskip\\
   293 \multicolumn{3}{l}{$\qquad\text{compile}(a_1) \;@\; \text{compile}(a_2)\;@\; \text{isub}$}\smallskip\\
   295 $\text{compile}(a_1 * a_2)$ & $\dn$\\ 
   294 $\text{compile}(a_1 * a_2)$ & $\dn$\\ 
   296 \multicolumn{3}{l}{$\qquad\text{compile}(a_1) \;@\; \text{compile}(a_2)\;@\; \text{imul}$}\smallskip\\
   295 \multicolumn{3}{l}{$\qquad\text{compile}(a_1) \;@\; \text{compile}(a_2)\;@\; \text{imul}$}\smallskip\\
   297 \end{tabular}}
   296 \end{tabular}}
   298 \end{center}\pause
   297 \end{center}
   299 
   298 
   300 \end{frame}}
   299 \end{frame}
   301 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
   300 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
   302 
   301 
   303 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   302 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   304 \mode<presentation>{
   303 \mode<presentation>{
   305 \begin{frame}[t]
   304 \begin{frame}[t]
   323 
   322 
   324 \end{frame}}
   323 \end{frame}}
   325 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
   324 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
   326 
   325 
   327 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   326 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   328 \mode<presentation>{
   327 \begin{frame}[t]
   329 \begin{frame}[t]
   328 \frametitle{Variables}
   330 \frametitle{\begin{tabular}{c}Variables\end{tabular}}
       
   331 
   329 
   332 {\Large\bl{$x := 5 + y * 2$}}\bigskip\pause   
   330 {\Large\bl{$x := 5 + y * 2$}}\bigskip\pause   
   333 
   331 
   334 \begin{itemize}
   332 \begin{itemize}
   335 \item lookup: \bl{$\text{iload}\; index$}
   333 \item lookup: \bl{$\text{iload}\; index$}
   341 
   339 
   342 \begin{center}
   340 \begin{center}
   343 \bl{$\text{compile}(a, E)$}
   341 \bl{$\text{compile}(a, E)$}
   344 \end{center}
   342 \end{center}
   345 
   343 
   346 \end{frame}}
   344 \end{frame}
   347 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
   345 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
   348 
   346 
   349 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   347 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   350 \mode<presentation>{
   348 \begin{frame}[t]
   351 \begin{frame}[t]
   349 \frametitle{Compiling AExps}
   352 \frametitle{\begin{tabular}{c}Compiling AExps\end{tabular}}
       
   353 
   350 
   354 \begin{center}
   351 \begin{center}
   355 \bl{\begin{tabular}{@{}lcl@{}}
   352 \bl{\begin{tabular}{@{}lcl@{}}
   356 $\text{compile}(n, E)$ & $\dn$ & $\text{ldc}\;n$\\
   353 $\text{compile}(n, E)$ & $\dn$ & $\text{ldc}\;n$\\
   357 $\text{compile}(a_1 + a_2, E)$ & $\dn$\\ 
   354 $\text{compile}(a_1 + a_2, E)$ & $\dn$\\ 
   358 \multicolumn{3}{l}{$\qquad\text{compile}(a_1, E) \;@\;\text{compile}(a_2. E)\;@\; \text{iadd}$}\smallskip\\
   355 \multicolumn{3}{l}{$\qquad\text{compile}(a_1, E) \;@\;\text{compile}(a_2, E)\;@\; \text{iadd}$}\smallskip\\
   359 $\text{compile}(a_1 - a_2, E)$ & $\dn$\\ 
   356 $\text{compile}(a_1 - a_2, E)$ & $\dn$\\ 
   360 \multicolumn{3}{l}{$\qquad\text{compile}(a_1, E) \;@\; \text{compile}(a_2, E)\;@\; \text{isub}$}\smallskip\\
   357 \multicolumn{3}{l}{$\qquad\text{compile}(a_1, E) \;@\; \text{compile}(a_2, E)\;@\; \text{isub}$}\smallskip\\
   361 $\text{compile}(a_1 * a_2, E)$ & $\dn$\\ 
   358 $\text{compile}(a_1 * a_2, E)$ & $\dn$\\ 
   362 \multicolumn{3}{l}{$\qquad\text{compile}(a_1, E) \;@\; \text{compile}(a_2, E)\;@\; \text{imul}$}\bigskip\\
   359 \multicolumn{3}{l}{$\qquad\text{compile}(a_1, E) \;@\; \text{compile}(a_2, E)\;@\; \text{imul}$}\bigskip\\
   363 $\text{compile}(x, E)$ & $\dn$ & $\text{iload}\;E(x)$\\
   360 $\text{compile}(x, E)$ & $\dn$ & $\text{iload}\;E(x)$\\
   364 \end{tabular}}
   361 \end{tabular}}
   365 \end{center}\pause
   362 \end{center}
   366 
   363 
   367 \end{frame}}
   364 \end{frame}
   368 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
   365 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
   369 
   366 
   370 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   367 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   371 \begin{frame}[t]
   368 \begin{frame}[t]
   372 \frametitle{Compiling Statements}
   369 \frametitle{Compiling Statements}