updated
authorChristian Urban <urbanc@in.tum.de>
Thu, 21 Nov 2019 14:41:53 +0000
changeset 697 370508e4d7f6
parent 696 3a5a7908517f
child 698 7c7854feccb5
updated
slides/slides08.pdf
slides/slides08.tex
Binary file slides/slides08.pdf has changed
--- a/slides/slides08.tex	Thu Nov 21 00:49:21 2019 +0000
+++ b/slides/slides08.tex	Thu Nov 21 14:41:53 2019 +0000
@@ -1,3 +1,4 @@
+% !TEX program = xelatex
 \documentclass[dvipsnames,14pt,t]{beamer}
 \usepackage{xcolor}
 \usepackage{../slides}
@@ -37,9 +38,10 @@
   \normalsize
   \begin{center}
   \begin{tabular}{ll}
-  Email:  & christian.urban at kcl.ac.uk\\
-  Office: & N7.07 (North Wing, Bush House)\\
-  Slides: & KEATS (also home work is there)\\
+    Email:  & christian.urban at kcl.ac.uk\\
+    Office Hours: & Thursdays 12 -- 14\\
+    Location: & N7.07 (North Wing, Bush House)\\
+    Slides \& Progs: & KEATS (also homework is there)\\  
   \end{tabular}
   \end{center}
 
@@ -80,7 +82,9 @@
 \begin{center}
 \bl{\begin{tikzpicture}
 \tikzset{level distance=12mm,sibling distance=4mm}
-\tikzset{edge from parent/.style={draw,very thick}}
\Tree [.$+$ [.$1$ ] [.$+$ [.$*$ $2$ $3$ ] [.$-$ $4$ $3$ ]]]
\end{tikzpicture}}
+\tikzset{edge from parent/.style={draw,very thick}}
+\Tree [.$+$ [.$1$ ] [.$+$ [.$*$ $2$ $3$ ] [.$-$ $4$ $3$ ]]]
+\end{tikzpicture}}
 \end{center}
 \end{column}
 \begin{column}{.3\textwidth}
@@ -154,10 +158,12 @@
 \end{lstlisting}
 \end{center}
 
-\begin{tikzpicture}[remember picture,overlay]
  \draw[->,very thick] (A) edge [->,to path={-- ++(10mm,0mm) 
+\begin{tikzpicture}[remember picture,overlay]
+  \draw[->,very thick] (A) edge [->,to path={-- ++(10mm,0mm) 
            -- ++(0mm,-17.3mm) |- (\tikztotarget)},line width=1mm] (B.east);
   \draw[->,very thick] (C) edge [->,to path={-- ++(10mm,0mm) 
-           -- ++(0mm,-17.3mm) |- (\tikztotarget)},line width=1mm] (D.east);
\end{tikzpicture}
+           -- ++(0mm,-17.3mm) |- (\tikztotarget)},line width=1mm] (D.east);
+\end{tikzpicture}
 
 \end{frame}
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
@@ -192,7 +198,8 @@
   \draw[->,very thick] (LA) edge [->,to path={-- ++(12mm,0mm) 
            -- ++(0mm,17.3mm) |- (\tikztotarget)},line width=1mm] (LB.east);
   \draw[->,very thick] (LC) edge [->,to path={-- ++(12mm,0mm) 
-           -- ++(0mm,-17.3mm) |- (\tikztotarget)},line width=1mm] (LD.east);
\end{tikzpicture}
+           -- ++(0mm,-17.3mm) |- (\tikztotarget)},line width=1mm] (LD.east);
+\end{tikzpicture}
 
 \end{frame}
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
@@ -279,13 +286,13 @@
 
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 \begin{frame}[c]
-\frametitle{Fun Grammar}
+\frametitle{Fun-Grammar}
 \bl{
 \begin{plstx}[rhs style=]
-: \meta{Exp} ::= \meta{Var} | \meta{Num}{\hspace{3cm}}
+: \meta{Exp} ::= \meta{Var} | \meta{Num}{\hspace{4cm}}
              |   \meta{Exp} + \meta{Exp} | ... | (\meta{Exp})
              |   \code{if} \meta{BExp} \code{then} \meta{Exp} \code{else} \meta{Exp}
-             |   \code{write} \meta{Exp} {\hspace{3cm}}
+             |   \code{write} \meta{Exp} {\hspace{5cm}}
              |   \meta{Exp} ; \meta{Exp}
              |   \textit{FunName} (\meta{Exp}, ... , \meta{Exp})\\
 : \meta{BExp} ::= ...\\
@@ -331,9 +338,11 @@
 
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 \begin{frame}[c, fragile]
-\frametitle{Idea}
+\frametitle{Ideas}
 
-Compile \texttt{exp} such that the result of the expression
+Use separate JVM methods for each Fun-function.\bigskip
+
+Compile \bl{\texttt{exp}}s such that the result of the expression
 is on top of the stack.\bigskip
 
 \begin{itemize}
@@ -412,7 +421,7 @@
 .end method
 \end{lstlisting}\bigskip
 
-\small We will need for definitions, like\footnotesize\medskip
+\small We will need methods for definitions like\footnotesize\medskip
 
 \begin{lstlisting}[language=JVMIS, 
                    xleftmargin=2mm, 
@@ -652,7 +661,7 @@
 
 then a call \texttt{f(args)} can be compiled as\medskip\small
 
-\begin{lstlisting}[basicstyle=\ttfamily, numbers=none]
+\begin{lstlisting}[numbers=none]
   prepare environment
   jump to start of function
 \end{lstlisting}
@@ -665,23 +674,22 @@
 \frametitle{Tail Recursive Call}
 \footnotesize
 
-\begin{textblock}{13}(-0.3,2)
-\begin{lstlisting}[language=Scala,basicstyle=\ttfamily, numbers=none]
+\begin{textblock}{13}(-0.3,3)
+\begin{lstlisting}[language=Scala, numbers=none]
 def compile_expT(a: Exp, env: Mem, name: String): Instrs = 
   ...
-  case Call(n, args) => if (name == n) 
-  { 
-    val stores = args.zipWithIndex.map 
-       { case (x, y) => "istore " + y.toString + "\n" } 
-    args.flatMap(a => compile_expT(a, env, "")) ++
-    stores.reverse ++ 
-    List ("goto " + n + "_Start\n") 
-  } 
-  else 
+  case Call(n, args) => if (name == n)
   {
+    val stores =
+      args.zipWithIndex.map { case (x, y) => i"istore $y" } 
+
+    args.map(a => compile_expT(a, env, "")).mkString ++
+    stores.reverse.mkString ++ 
+    i"goto ${n}_Start" 
+  } else {
     val is = "I" * args.length
-    args.flatMap(a => compile_expT(a, env, "")) ++
-    List ("invokestatic XXX/XXX/" + n + "(" + is + ")I\n")
+    args.map(a => compile_expT(a, env, "")).mkString ++
+    i"invokestatic XXX/XXX/${n}(${is})I"
   }
 \end{lstlisting}
 \end{textblock}
@@ -738,7 +746,6 @@
 
 
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%     
-
 \begin{frame}[c]
 \frametitle{Can This Be Done?}
 
@@ -781,6 +788,36 @@
 \end{frame}
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%     
 
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%     
+\begin{frame}[c]
+
+\begin{center}
+  \includegraphics[angle=90,scale=0.35]{/Users/cu/vote.pdf}
+\end{center}
+
+\end{frame}
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%     
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%     
+\begin{frame}[c]
+
+\begin{center}
+  \includegraphics[scale=0.25]{/Users/cu/dresden.png}
+\end{center}
+
+\begin{textblock}{13}(2,12)
+\includegraphics[scale=0.08]{/Users/cu/kiss.jpg}
+\end{textblock}
+
+\begin{textblock}{13}(7,12)
+\includegraphics[scale=0.079]{/Users/cu/pioniere.jpg}
+\end{textblock}
+
+\end{frame}
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%     
+
+
 \end{document}
 
 %%% Local Variables: