slides/slides01.tex
changeset 744 99c5916d9a8f
parent 743 6acabeecdf75
child 745 7dc3643a0cc5
--- a/slides/slides01.tex	Sat Aug 15 14:18:37 2020 +0100
+++ b/slides/slides01.tex	Mon Aug 17 17:42:37 2020 +0100
@@ -73,6 +73,143 @@
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\begin{frame}<1-11>[c]
+\frametitle{The Goal of this Module\ldots}
+
+\begin{center}
+  \begin{tikzpicture}[scale=1,
+                      node/.style={
+                      rectangle,rounded corners=3mm,
+                      very thick,draw=black!50,minimum height=18mm, minimum width=20mm,
+                      top color=white,bottom color=black!20,drop shadow}]
+
+  \node at (3.05, 1.8) {\Large\bf \ldots{} you write a compiler};
+
+  \node (0) at (-2.3,0) {};  
+  \node [above=5mm of 0]
+  {\makebox[0mm]{\footnotesize
+      \begin{tabular}{@{}l@{}}input\\[-1mm]program\end{tabular}}}; 
+     
+  \node (A) at (0,0)  [node] {};
+  \node [below right] at (A.north west) {lexer};
+
+  \node (B) at (3,0)  [node] {};
+  \node [below right=1mm] at (B.north west) {\mbox{}\hspace{-1mm}parser};
+
+  \node (C) at (6,0)  [node] {};
+  \node [below right] at (C.north west) {\mbox{}\hspace{-1mm}code gen};
+
+  \node (1) at (8.4,0) {};
+  \node [above=5mm of 1]
+  {\makebox[0mm]{\footnotesize
+      \begin{tabular}{@{}r@{}}binary\\[-1mm]code\end{tabular}}};
+
+  \draw [->,line width=4mm] (0) -- (A); 
+  \draw [->,line width=4mm] (A) -- (B); 
+  \draw [->,line width=4mm] (B) -- (C); 
+  \draw [->,line width=4mm] (C) -- (1); 
+  \end{tikzpicture}
+  \end{center}
+
+\only<2,3,4>{
+\begin{textblock}{1}(1,2.1)
+\begin{bubble}[9.8cm]
+\normalsize
+lexer input: a string\smallskip\\
+\hspace{5mm}\code{"read(n);"}\medskip\\
+lexer output: a sequence of tokens\smallskip\\
+\hspace{5mm}\code{key(read) lpar id(n) rpar semi}
+\end{bubble}
+\end{textblock}} 
+
+\only<3,4>{
+\begin{textblock}{1}(6,7.8)
+\begin{tabular}{c}
+\includegraphics[scale=0.2]{../pics/rosetta.jpg}\\[-2mm]
+\footnotesize lexing $\Rightarrow$ recognising words (Stone of Rosetta)
+\end{tabular}
+\end{textblock}}
+
+\only<4>{
+\begin{textblock}{1}(0.5,12)\small
+\begin{tabular}{l@{}c@{}l}
+  \pcode{if}    & $\;\Rightarrow\;$ & keyword\\
+  \pcode{iffoo} & $\;\Rightarrow\;$ & identifier\\
+\end{tabular}  
+\end{textblock}}
+
+\only<6>{
+\begin{textblock}{1}(1,1.5)
+\begin{bubble}[8.5cm]
+\normalsize
+parser input: a sequence of tokens\smallskip\\
+
+{\small\hspace{5mm}\code{key(read) lpar id(n) rpar semi}}\smallskip\\
+
+parser output: an abstract syntax tree\smallskip\\
+\footnotesize
+\hspace{2cm}\begin{tikzpicture}
+  \node {\code{read}}
+    child {node {\code{lpar}}}
+    child {node {\code{n}}}
+    child {node {\code{rpar}}};
+\end{tikzpicture}
+\end{bubble}
+\end{textblock}}
+
+\only<8,9>{
+\begin{textblock}{1}(1,1.5)
+\begin{bubble}[4cm]
+\normalsize
+code generation:\smallskip\\
+\hspace{5mm}\code{istore 2}\\ 
+\hspace{5mm}\code{iload 2}\\ 
+\hspace{5mm}\code{ldc 10}\\
+\hspace{5mm}\code{isub}\\
+\hspace{5mm}\code{ifeq Label2}\\ 
+\hspace{5mm}\code{iload 2}\\
+\hspace{5mm}\code{...}\\
+\end{bubble}
+\end{textblock}}
+
+\only<9>{
+\begin{textblock}{6}(8.4,7)
+\begin{bubble}[5cm]
+\mbox{\begin{tikzpicture}[scale=0.58,rounded corners=0mm]
+\begin{axis}[axis x line=bottom, axis y line=left, ylabel=secs,
+    xlabel=n,
+    enlargelimits=0.05,
+    ybar interval=0.7, legend style=small]
+\addplot file {interpreted2.data};
+\addplot file {compiled2.data};
+%\legend{interpreted, compiled}
+\end{axis}
+\end{tikzpicture}}
+\end{bubble}
+\end{textblock}}
+
+\only<10>{
+\begin{textblock}{6}(1,3)
+  \begin{bubble}[11cm]
+  Compiler explorers, e.g.: \url{https://gcc.godbolt.org}  
+  \begin{tikzpicture}[]
+  \node (0) at (-2.3,0) {\includegraphics[scale=0.3]{pics/csource.png}};
+  \node (1) [right=35mm] at (0) {\includegraphics[scale=0.3]{pics/cassmbl.png}}; 
+  \draw [->,line width=4mm, red] (0) -- (1);   
+  \node (2) [below=20mm] at (0) {\LARGE\bf``source''};
+  \node (3) [right=40mm] at (2) {\LARGE\bf``binary''};
+  \draw [->,line width=1mm] (2) -- (3);   
+\end{tikzpicture}
+\end{bubble}
+\end{textblock}}
+
+
+\end{frame}
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%     
+
+
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 \begin{frame}[t]
 \frametitle{Why Study Compilers?}
 
@@ -117,34 +254,13 @@
 \end{frame}
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-\begin{frame}[t]
-  \frametitle{What are Compilers?}
- 
-\begin{center}
-\begin{tikzpicture}[]
-  \node (0) at (-2.3,0) {\includegraphics[scale=0.3]{pics/csource.png}};
-  \node (1) [right=35mm] at (0) {\includegraphics[scale=0.3]{pics/cassmbl.png}}; 
-  \draw [->,line width=4mm, red] (0) -- (1);   
-  \node (2) [below=25mm] at (0) {\LARGE\bf``source''};
-  \node (3) [right=40mm] at (2) {\LARGE\bf``binary''};
-  \draw [->,line width=1mm] (2) -- (3);   
-\end{tikzpicture}
-\end{center}
-
-\begin{textblock}{12}(1,14.5)
-Compiler explorers, e.g.: \url{https://gcc.godbolt.org}
-\end{textblock}
-
-\end{frame} 
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%  
 
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 \begin{frame}[c]
-\frametitle{\begin{tabular}{c}Why Bother?\\[-2mm] Compilers \& Boeings 777\end{tabular}}
+\frametitle{Why Bother with Compilers?}
   
-First flight in 1994. They want to achieve triple redundancy in hardware
-faults.\bigskip
+\textbf{Boeings 777}: First flight in 1994. They want to achieve
+triple redundancy in hardware faults.\bigskip
   
 They compile 1 Ada program to\medskip
   
@@ -166,7 +282,7 @@
 \frametitle{Why Bother?}
 
 \begin{columns}[t]
-\begin{column}{.5\textwidth}
+\begin{column}{.4\textwidth}
 Ruby, Python, Java 8\medskip\\
 \begin{tikzpicture}\footnotesize
 \begin{axis}[
@@ -213,7 +329,7 @@
 \end{tikzpicture}
 
 \end{column}
-\begin{column}{.5\textwidth}
+\begin{column}{.4\textwidth}
 Us (after next lecture)\medskip\\
 \begin{tikzpicture}\footnotesize
 \begin{axis}[
@@ -312,125 +428,6 @@
 
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 \begin{frame}[c]
-\frametitle{The Goal of this Module}
-
-\begin{center}
-  \begin{tikzpicture}[scale=1,
-                      node/.style={
-                      rectangle,rounded corners=3mm,
-                      very thick,draw=black!50,minimum height=18mm, minimum width=20mm,
-                      top color=white,bottom color=black!20,drop shadow}]
-
-  \node at (3.05, 1.8) {\Large\bf write a compiler};
-
-  \node (0) at (-2.3,0) {};  
-  \node [above=5mm of 0]
-  {\makebox[0mm]{\footnotesize
-      \begin{tabular}{@{}l@{}}input\\[-1mm]program\end{tabular}}}; 
-     
-  \node (A) at (0,0)  [node] {};
-  \node [below right] at (A.north west) {lexer};
-
-  \node (B) at (3,0)  [node] {};
-  \node [below right=1mm] at (B.north west) {\mbox{}\hspace{-1mm}parser};
-
-  \node (C) at (6,0)  [node] {};
-  \node [below right] at (C.north west) {\mbox{}\hspace{-1mm}code gen};
-
-  \node (1) at (8.4,0) {};
-  \node [above=5mm of 1]
-  {\makebox[0mm]{\footnotesize
-      \begin{tabular}{@{}r@{}}binary\\[-1mm]code\end{tabular}}};
-
-  \draw [->,line width=4mm] (0) -- (A); 
-  \draw [->,line width=4mm] (A) -- (B); 
-  \draw [->,line width=4mm] (B) -- (C); 
-  \draw [->,line width=4mm] (C) -- (1); 
-  \end{tikzpicture}
-  \end{center}
-
-\only<2,3,4>{
-\begin{textblock}{1}(1,2.1)
-\begin{bubble}[9.8cm]
-\normalsize
-lexer input: a string\smallskip\\
-\hspace{5mm}\code{"read(n);"}\medskip\\
-lexer output: a sequence of tokens\smallskip\\
-\hspace{5mm}\code{key(read) lpar id(n) rpar semi}
-\end{bubble}
-\end{textblock}} 
-
-\only<3,4>{
-\begin{textblock}{1}(6,7.8)
-\begin{tabular}{c}
-\includegraphics[scale=0.2]{../pics/rosetta.jpg}\\[-2mm]
-\footnotesize lexing $\Rightarrow$ recognising words (Stone of Rosetta)
-\end{tabular}
-\end{textblock}}
-
-\only<4>{
-\begin{textblock}{1}(0.5,12)\small
-\begin{tabular}{l@{}c@{}l}
-  \pcode{if}    & $\;\Rightarrow\;$ & keyword\\
-  \pcode{iffoo} & $\;\Rightarrow\;$ & identifier\\
-\end{tabular}  
-\end{textblock}}
-
-\only<5>{
-\begin{textblock}{1}(1,1.5)
-\begin{bubble}[8.5cm]
-\normalsize
-parser input: a sequence of tokens\smallskip\\
-
-{\small\hspace{5mm}\code{key(read) lpar id(n) rpar semi}}\smallskip\\
-
-parser output: an abstract syntax tree\smallskip\\
-\footnotesize
-\hspace{2cm}\begin{tikzpicture}
-  \node {\code{read}}
-    child {node {\code{lpar}}}
-    child {node {\code{n}}}
-    child {node {\code{rpar}}};
-\end{tikzpicture}
-\end{bubble}
-\end{textblock}}
-
-\only<6,7>{
-\begin{textblock}{1}(1,1.5)
-\begin{bubble}[4cm]
-\normalsize
-code generator:\smallskip\\
-\hspace{5mm}\code{istore 2}\\ 
-\hspace{5mm}\code{iload 2}\\ 
-\hspace{5mm}\code{ldc 10}\\
-\hspace{5mm}\code{isub}\\
-\hspace{5mm}\code{ifeq Label2}\\ 
-\hspace{5mm}\code{iload 2}\\
-\hspace{5mm}\code{...}\\
-\end{bubble}
-\end{textblock}}
-
-\only<7>{
-\begin{textblock}{6}(8.4,7)
-\begin{bubble}[5cm]
-\mbox{\begin{tikzpicture}[scale=0.58,rounded corners=0mm]
-\begin{axis}[axis x line=bottom, axis y line=left, ylabel=secs,
-    xlabel=n,
-    enlargelimits=0.05,
-    ybar interval=0.7, legend style=small]
-\addplot file {interpreted2.data};
-\addplot file {compiled2.data};
-%\legend{interpreted, compiled}
-\end{axis}
-\end{tikzpicture}}
-\end{bubble}
-\end{textblock}}
-
-\end{frame}
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%     
-
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-\begin{frame}[c]
 \frametitle{The Acad.~Subject is Mature}
 
 \bigskip