217 \item some languages compiled to the JVM: Scala, Clojure\ldots |
217 \item some languages compiled to the JVM: Scala, Clojure\ldots |
218 \end{itemize} |
218 \end{itemize} |
219 |
219 |
220 \end{frame} |
220 \end{frame} |
221 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
221 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
222 |
222 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
223 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
223 \begin{frame}[t,fragile] |
224 \begin{frame}[t] |
|
225 \frametitle{Compiling AExps} |
224 \frametitle{Compiling AExps} |
226 |
225 |
227 {\Large\bl{1 + 2}} |
226 For example \bl{$1 + ((2 * 3) + (4 - 3))$}:\medskip |
228 |
227 |
229 \begin{center} |
228 \begin{columns}[T] |
230 \bl{\begin{tabular}{l} |
229 \begin{column}{.3\textwidth} |
231 ldc 1\\ |
230 \begin{center} |
232 ldc 2\\ |
231 \bl{\begin{tikzpicture} |
233 iadd\\ |
232 \tikzset{level distance=12mm,sibling distance=4mm} |
234 \end{tabular}} |
233 \tikzset{edge from parent/.style={draw,very thick}} |
235 \end{center} |
234 \Tree [.$+$ [.$1$ ] [.$+$ [.$*$ $2$ $3$ ] [.$-$ $4$ $3$ ]]] |
236 \end{frame} |
235 \end{tikzpicture}} |
237 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
236 \end{center} |
238 |
237 \end{column} |
239 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
238 \begin{column}{.3\textwidth} |
240 \mode<presentation>{ |
239 \begin{lstlisting}[language=JVMIS,numbers=none] |
|
240 ldc 1 |
|
241 ldc 2 |
|
242 ldc 3 |
|
243 imul |
|
244 ldc 4 |
|
245 ldc 3 |
|
246 isub |
|
247 iadd |
|
248 iadd |
|
249 \end{lstlisting} |
|
250 \end{column} |
|
251 \end{columns}\bigskip |
|
252 |
|
253 \small |
|
254 Traverse tree in post-order \bl{$\Rightarrow$} code for |
|
255 stack-machine |
|
256 |
|
257 \end{frame} |
|
258 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
259 |
|
260 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
241 \begin{frame}[t] |
261 \begin{frame}[t] |
242 \frametitle{\begin{tabular}{c}Compiling AExps\end{tabular}} |
262 \frametitle{\begin{tabular}{c}Compiling AExps\end{tabular}} |
243 |
263 |
244 {\Large\bl{1 + 2 + 3}} |
264 {\Large\bl{1 + 2 + 3}} |
245 |
265 |
846 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
866 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
847 |
867 |
848 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
868 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
849 \mode<presentation>{ |
869 \mode<presentation>{ |
850 \begin{frame}[t] |
870 \begin{frame}[t] |
851 \frametitle{\begin{tabular}{c}What Next\end{tabular}} |
871 \frametitle{\begin{tabular}{c}What is Next\end{tabular}} |
852 |
872 |
853 \begin{itemize} |
873 \begin{itemize} |
854 \item register spilling |
874 \item register spilling |
855 \item dead code removal |
875 \item dead code removal |
856 \item loop optimisations |
876 \item loop optimisations |
864 \end{itemize} |
884 \end{itemize} |
865 |
885 |
866 \end{frame}} |
886 \end{frame}} |
867 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
887 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
868 |
888 |
|
889 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
890 \begin{frame}[c] |
|
891 \frametitle{Coursework: MkEps} |
|
892 |
|
893 \begin{center} |
|
894 \begin{tabular}{@ {}l@ {\hspace{2mm}}c@ {\hspace{2mm}}l@ {}} |
|
895 \bl{$mkeps([c_1 c_2 \ldots c_n])$} & \bl{$\dn$} & $\bl{undefined}$\\ |
|
896 \bl{$mkeps(r^*)$} & \bl{$\dn$} & $\bl{Stars\,[]}$\\ |
|
897 \bl{$mkeps(r^{\{n\}})$} & \bl{$\dn$} & $\bl{Stars\,(mkeps(r))^n}$\\ |
|
898 \bl{$mkeps(r^{\{n..\}})$} & \bl{$\dn$} & $\bl{Stars\,(mkeps(r))^n}$\\ |
|
899 \bl{$mkeps(r^{\{..n\}})$} & \bl{$\dn$} & $\bl{Stars\,[]}$\\ |
|
900 \bl{$mkeps(r^{\{n..m\}})$} & \bl{$\dn$} & $\bl{Stars\,(mkeps(r))^n}$\medskip\\ |
|
901 |
|
902 \bl{$mkeps(r^+)$} & \bl{$\dn$} & \bl{$mkeps(r^{\{1..\}})$}\\ |
|
903 \bl{$mkeps(r^?)$} & \bl{$\dn$} & \bl{$mkeps(r^{\{..1\}})$}\\ |
|
904 \end{tabular} |
|
905 \end{center} |
|
906 |
|
907 \end{frame} |
|
908 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
909 |
|
910 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
911 \begin{frame}[c] |
|
912 \frametitle{Coursework: Inj} |
|
913 |
|
914 \begin{center} |
|
915 \begin{tabular}{@ {}l@ {\hspace{2mm}}c@ {\hspace{2mm}}l@ {}} |
|
916 \bl{$inj([c_1 c_2 \ldots c_n])\,c\,Empty$} & \bl{$\dn$} & $\bl{Chr\,c}$\\ |
|
917 \bl{$inj(r^*)\,c\;Seq\,v\,(Stars\,vs)$} & \bl{$\dn$} & $\bl{Stars\,(inj\,r\,c\,v::vs)}$\\ |
|
918 \bl{$inj(r^{\{n\}})\,c\;Seq\,v\,(Stars\,vs)$} & \bl{$\dn$} & $\bl{Stars\,(inj\,r\,c\,v::vs)}$\\ |
|
919 \bl{$inj(r^{\{n..\}})\,c\;Seq\,v\,(Stars\,vs)$} & \bl{$\dn$} & $\bl{Stars\,(inj\,r\,c\,v::vs)}$\\ |
|
920 \bl{$inj(r^{\{..n\}})\,c\;Seq\,v\,(Stars\,vs)$} & \bl{$\dn$} & $\bl{Stars\,(inj\,r\,c\,v::vs)}$\\ |
|
921 \bl{$inj(r^{\{n..m\}})\,c\;Seq\,v\,(Stars\,vs)$} & \bl{$\dn$} & $\bl{Stars\,(inj\,r\,c\,v::vs)}$\medskip\\ |
|
922 |
|
923 \bl{$inj(r^+)\,c\,v$} & \bl{$\dn$} & \bl{$inj(r^{\{1..\}})\,c\,v$}\\ |
|
924 \bl{$inj(r^?)\,c\,v$} & \bl{$\dn$} & \bl{$inj(r^{\{..1\}})\,c\,v$}\\ |
|
925 \end{tabular} |
|
926 \end{center} |
|
927 |
|
928 \end{frame} |
|
929 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
930 |
869 |
931 |
870 \end{document} |
932 \end{document} |
871 |
933 |
872 %%% Local Variables: |
934 %%% Local Variables: |
873 %%% mode: latex |
935 %%% mode: latex |