slides/slides09.tex
changeset 702 39e21a33ffb0
parent 701 681c36b2af27
child 744 99c5916d9a8f
--- a/slides/slides09.tex	Thu Nov 28 08:18:57 2019 +0000
+++ b/slides/slides09.tex	Tue Dec 03 01:21:50 2019 +0000
@@ -40,7 +40,7 @@
 
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 \begin{frame}[c,fragile]
-\frametitle{Functional Programming}
+\frametitle{The Fun Language}
 
 \footnotesize
 \begin{textblock}{13}(0.9,3)
@@ -64,7 +64,7 @@
 
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 \begin{frame}[c,fragile]
-\frametitle{Factorial on the JVM}
+\frametitle{Factorial Funct.~on the JVM}
 
 \begin{textblock}{7}(1,1.8)\footnotesize
 \begin{minipage}{6cm}
@@ -228,10 +228,10 @@
 
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 \begin{frame}[fragile,c]
-\frametitle{LLVM Instructions}
+\frametitle{LLVM-IR Instructions}
 \small
 
-\begin{lstlisting}[language=LLVM]
+\begin{lstlisting}[language=LLVM,xleftmargin=0mm]
 br i1 %var, label %if_br, label %else_br
 
 icmp eq i32  %x, %y     ; for equal
@@ -252,12 +252,13 @@
 \bl{$(1 + a) + (3 + (b * 5))$}\bigskip\bigskip
 
 \begin{lstlisting}[language=LLVM]
-let tmp0 = add 1 a in   
-let tmp1 = mul b 5 in 
-let tmp2 = add 3 tmp1 in 
-let tmp3 = add tmp0 tmp2 in
-  tmp3 
-\end{lstlisting}
+tmp0 = add 1 a   
+tmp1 = mul b 5 
+tmp2 = add 3 tmp1 
+tmp3 = add tmp0 tmp2  
+\end{lstlisting}\bigskip\bigskip
+
+\hfill Static Single Assignment
 
 \end{frame}
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -294,12 +295,14 @@
 abstract class KExp
 abstract class KVal
 
+// K-Values
 case class KVar(s: String) extends KVal
 case class KNum(i: Int) extends KVal
 case class Kop(o: String, v1: KVal, v2: KVal) extends KVal
 case class KCall(o: String, vrs: List[KVal]) extends KVal
 case class KWrite(v: KVal) extends KVal
 
+// K-Expressions
 case class KIf(x1: String, e1: KExp, e2: KExp) extends KExp
 case class KLet(x: String, v: KVal, e: KExp) extends KExp
 case class KReturn(v: KVal) extends KExp
@@ -319,6 +322,8 @@
 \end{lstlisting}
 \bigskip\bigskip
 
+the continuation \texttt{k} can be thought of:\medskip
+
 \small
 \begin{lstlisting}[language=LLVMIR,numbers=none,xleftmargin=30mm,escapeinside={(*@}{@*)}]
 let tmp0 = add 1 a in   
@@ -373,13 +378,13 @@
   } ...
 }
 \end{lstlisting}
-
-\small
+\mbox{}\\[-8mm]%
+%
 \begin{lstlisting}[language=LLVMIR,numbers=none,xleftmargin=30mm,escapeinside={(*@}{@*)}]
 ...
 let z = op (*@$\Box_{y_1}$@*) (*@$\Box_{y_2}$@*)
 let tmp0 = add 1 a in   
-let tmp1 = mul (*@$\Box\!\!\!\!\raisebox{0.6mm}{\texttt{z}}$@*) 5 in 
+let tmp1 = mul (*@$\Box\!\!\!\!\raisebox{0.6mm}{\alert{\texttt{z}}}$@*) 5 in 
 let tmp2 = add 3 tmp1 in 
 let tmp3 = add tmp0 tmp2 in
   KReturn tmp3 
@@ -401,35 +406,7 @@
      ...
   }
 \end{lstlisting}
-\bigskip\bigskip
-
-\small
-\begin{lstlisting}[language=LLVMIR,numbers=none,xleftmargin=30mm,escapeinside={(*@}{@*)}]
-let tmp0 = add 1 a in   
-let tmp1 = mul (*@$\Box$@*) 5 in 
-let tmp2 = add 3 tmp1 in 
-let tmp3 = add tmp0 tmp2 in
-  KReturn tmp3 
-\end{lstlisting}
-
-\end{frame}
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-\begin{frame}[fragile,c]
-\frametitle{CPS-Translation}
-\small
-
-\begin{lstlisting}[language=Scala,numbers=none]
-def CPS(e: Exp)(k: KVal => KExp) : KExp = 
-  e match { 
-    ...
-    case Sequence(e1, e2) => 
-      CPS(e1)(_ => CPS(e2)(y2 => k(y2)))
-     ...
-  }
-\end{lstlisting}
-\bigskip\bigskip
+\bigskip
 
 \small
 \begin{lstlisting}[language=LLVMIR,numbers=none,xleftmargin=30mm,escapeinside={(*@}{@*)}]
@@ -466,6 +443,43 @@
 \end{frame}
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\begin{frame}[c,fragile]
+\frametitle{The Basic Language, 1980+}
+
+\begin{lstlisting}[language={[Visual]Basic},numbers=none]
+ 5 LET S = 0
+10 INPUT V 
+20 PRINT "Input number"
+30 IF N = 0 THEN GOTO 99 
+40 FOR I = 1 TO N 
+45 LET S = S + V(I) 
+50 NEXT I 
+60 PRINT S/N 
+70 GOTO 5 
+99 END
+\end{lstlisting}
+
+\hfill ``Spaghetti Code''
+\end{frame}
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
+
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\begin{frame}[c,fragile]
+\frametitle{Target Specific ASM}
+
+\begin{lstlisting}[language={},numbers=none]
+llc -march=x86-64 fact.ll 
+llc -march=arm fact.ll
+
+
+Intel:  xorl  %eax, %eax
+ARM:    mov   pc, lr
+\end{lstlisting}
+
+\end{frame}
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%