slides/slides07.tex
changeset 808 ba3edaf7dc49
parent 807 9fa90c73c6f3
child 810 ba25eaf6043c
equal deleted inserted replaced
807:9fa90c73c6f3 808:ba3edaf7dc49
    79   \draw [->,line width=4mm] (0) -- (A); 
    79   \draw [->,line width=4mm] (0) -- (A); 
    80   \draw [->,line width=4mm] (A) -- (B); 
    80   \draw [->,line width=4mm] (A) -- (B); 
    81   \draw [->,line width=4mm] (B) -- (C); 
    81   \draw [->,line width=4mm] (B) -- (C); 
    82   \draw [->,line width=4mm] (C) -- (1); 
    82   \draw [->,line width=4mm] (C) -- (1); 
    83   \end{tikzpicture}
    83   \end{tikzpicture}
       
    84   \end{center}\pause
       
    85 
       
    86   \begin{center}
       
    87 \begin{tikzpicture}[scale=1,font=\bf,
       
    88                       node/.style={
       
    89                       rectangle,rounded corners=3mm,
       
    90                       ultra thick,draw=black!50,minimum height=18mm, 
       
    91                       minimum width=20mm,
       
    92                       top color=white,bottom color=black!20}]
       
    93 
       
    94   \node (0) at (-3,0) {};  
       
    95   \node (A) at (0,0) [node,text width=1.6cm,text centered] {\small{}our compiler};
       
    96   \node (B) at (3.5,0) [node,text width=1.6cm,text centered] {\small{}Jasmin / Krakatau};
       
    97   \node (C) at (7.5,0) [node] {JVM};
       
    98  
       
    99   \draw [->,line width=2.5mm] (0) -- node [above,pos=0.35] {*.while} (A); 
       
   100   \draw [->,line width=2.5mm] (A) -- node [above,pos=0.35] {*.j} (B); 
       
   101   \draw [->,line width=2.5mm] (B) -- node [above,pos=0.35] {*.class} (C); 
       
   102   \end{tikzpicture}
    84   \end{center}
   103   \end{center}
    85   
   104 \end{frame}
    86 \end{frame}
   105 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    87 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   106 
    88 
   107 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
       
   108 \begin{frame}[c]
       
   109 \frametitle{Test Program}
       
   110 
       
   111 \mbox{}\\[-18mm]\mbox{}
       
   112 
       
   113 {\lstset{language=While}\fontsize{10}{12}\selectfont
       
   114 \texttt{\lstinputlisting{../progs/while-tests/loops.while}}}
       
   115 
       
   116 \end{frame}
       
   117 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
    89 
   118 
    90 
   119 
    91 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   120 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    92 \begin{frame}[c]
   121 \begin{frame}[c]
    93 \begin{textblock}{10}(0.5,0.5)
   122 \begin{textblock}{10}(0.5,0.5)
   120 
   149 
   121 \end{frame}
   150 \end{frame}
   122 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
   151 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
   123  
   152  
   124  
   153  
   125  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   154 %  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   126 \begin{frame}[t]
   155 % \begin{frame}[t]
   127 
   156 
   128 \begin{center}
   157 % \begin{center}
   129 \bl{\begin{tabular}{@{}lcl@{}}
   158 % \bl{\begin{tabular}{@{}lcl@{}}
   130 \\[-12mm]        
   159 % \\[-12mm]        
   131 \meta{Stmt} & $::=$ &  $\texttt{skip}$\\
   160 % \meta{Stmt} & $::=$ &  $\texttt{skip}$\\
   132               & $|$ & \textit{Id}\;\texttt{:=}\;\meta{AExp}\\
   161 %               & $|$ & \textit{Id}\;\texttt{:=}\;\meta{AExp}\\
   133               & $|$ & \texttt{if}\; \meta{BExp} \;\texttt{then}\; \meta{Block} \;\texttt{else}\; \meta{Block}\\
   162 %               & $|$ & \texttt{if}\; \meta{BExp} \;\texttt{then}\; \meta{Block} \;\texttt{else}\; \meta{Block}\\
   134               & $|$ & \texttt{while}\; \meta{BExp} \;\texttt{do}\; \meta{Block}\\
   163 %               & $|$ & \texttt{while}\; \meta{BExp} \;\texttt{do}\; \meta{Block}\\
   135               & $|$ & \texttt{read}\;\textit{Id}\\
   164 %               & $|$ & \texttt{read}\;\textit{Id}\\
   136               & $|$ & \texttt{write}\;\textit{Id}\\
   165 %               & $|$ & \texttt{write}\;\textit{Id}\\
   137               & $|$ & \texttt{write}\;\textit{String}\medskip\\
   166 %               & $|$ & \texttt{write}\;\textit{String}\medskip\\
   138 \meta{Stmts} & $::=$ &  \meta{Stmt} \;\texttt{;}\; \meta{Stmts}\\
   167 % \meta{Stmts} & $::=$ &  \meta{Stmt} \;\texttt{;}\; \meta{Stmts}\\
   139               & $|$ & \meta{Stmt}\medskip\\
   168 %               & $|$ & \meta{Stmt}\medskip\\
   140 \meta{Block} & $::=$ &  \texttt{\{}\,\meta{Stmts}\,\texttt{\}}\\
   169 % \meta{Block} & $::=$ &  \texttt{\{}\,\meta{Stmts}\,\texttt{\}}\\
   141                 & $|$ & \meta{Stmt}\medskip\\
   170 %                 & $|$ & \meta{Stmt}\medskip\\
   142 \meta{AExp} & $::=$ & \ldots\\
   171 % \meta{AExp} & $::=$ & \ldots\\
   143 \meta{BExp} & $::=$ & \ldots\\
   172 % \meta{BExp} & $::=$ & \ldots\\
   144 \end{tabular}}
   173 % \end{tabular}}
   145 \end{center}
   174 % \end{center}
   146 \end{frame}
   175 % \end{frame}
   147 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
   176 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
   148 
   177 
   149 
   178 
   150 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   179 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   151 \begin{frame}[c]
   180 % \begin{frame}[c]
   152 \frametitle{\begin{tabular}{c}Fibonacci Numbers\end{tabular}}
   181 % \frametitle{\begin{tabular}{c}Fibonacci Numbers\end{tabular}}
   153 
   182 
   154 \mbox{}\\[-18mm]\mbox{}
   183 % \mbox{}\\[-18mm]\mbox{}
   155 ??
   184 % ??
   156 %{\lstset{language=While}\fontsize{10}{12}\selectfont
   185 % %{\lstset{language=While}\fontsize{10}{12}\selectfont
   157 %\texttt{\lstinputlisting{../progs/fib.while}}}
   186 % %\texttt{\lstinputlisting{../progs/fib.while}}}
   158 
   187 
   159 \end{frame}
   188 % \end{frame}
   160 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
   189 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
   161 
   190 
   162 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   191 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   163 \begin{frame}[c]
   192 % \begin{frame}[c]
   164 \frametitle{Interpreter}
   193 % \frametitle{Interpreter}
   165 
   194 
   166 \begin{center}
   195 % \begin{center}
   167 \bl{\begin{tabular}{@{}lcl@{}}
   196 % \bl{\begin{tabular}{@{}lcl@{}}
   168 $\text{eval}(n, E)$ & $\dn$ & $n$\\
   197 % $\text{eval}(n, E)$ & $\dn$ & $n$\\
   169 $\text{eval}(x, E)$ & $\dn$ & $E(x)$ \;\;\;\textcolor{black}{lookup \bl{$x$} in \bl{$E$}}\\
   198 % $\text{eval}(x, E)$ & $\dn$ & $E(x)$ \;\;\;\textcolor{black}{lookup \bl{$x$} in \bl{$E$}}\\
   170 $\text{eval}(a_1 + a_2, E)$ & $\dn$ & $\text{eval}(a_1, E) + \text{eval}(a_2, E)$\\
   199 % $\text{eval}(a_1 + a_2, E)$ & $\dn$ & $\text{eval}(a_1, E) + \text{eval}(a_2, E)$\\
   171 $\text{eval}(a_1 - a_2, E)$ & $\dn$ & $\text{eval}(a_1, E) - \text{eval}(a_2, E)$\\
   200 % $\text{eval}(a_1 - a_2, E)$ & $\dn$ & $\text{eval}(a_1, E) - \text{eval}(a_2, E)$\\
   172 $\text{eval}(a_1 * a_2, E)$ & $\dn$ & $\text{eval}(a_1, E) * \text{eval}(a_2, E)$\bigskip\\
   201 % $\text{eval}(a_1 * a_2, E)$ & $\dn$ & $\text{eval}(a_1, E) * \text{eval}(a_2, E)$\bigskip\\
   173 $\text{eval}(a_1 = a_2, E)$ & $\dn$ & $\text{eval}(a_1, E) = \text{eval}(a_2, E)$\\
   202 % $\text{eval}(a_1 = a_2, E)$ & $\dn$ & $\text{eval}(a_1, E) = \text{eval}(a_2, E)$\\
   174 $\text{eval}(a_1\,!\!= a_2, E)$ & $\dn$ & $\neg(\text{eval}(a_1, E) = \text{eval}(a_2, E))$\\
   203 % $\text{eval}(a_1\,!\!= a_2, E)$ & $\dn$ & $\neg(\text{eval}(a_1, E) = \text{eval}(a_2, E))$\\
   175 $\text{eval}(a_1 < a_2, E)$ & $\dn$ & $\text{eval}(a_1, E) < \text{eval}(a_2, E)$\
   204 % $\text{eval}(a_1 < a_2, E)$ & $\dn$ & $\text{eval}(a_1, E) < \text{eval}(a_2, E)$\
   176 \end{tabular}}
   205 % \end{tabular}}
   177 \end{center}
   206 % \end{center}
   178 
   207 
   179 \end{frame}
   208 % \end{frame}
   180 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
   209 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
   181 
   210 
   182 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   211 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   183 \begin{frame}[c]
   212 % \begin{frame}[c]
   184 \frametitle{Interpreter (2)}
   213 % \frametitle{Interpreter (2)}
   185 
   214 
   186 \begin{center}
   215 % \begin{center}
   187 \bl{\begin{tabular}{@{}lcl@{}}
   216 % \bl{\begin{tabular}{@{}lcl@{}}
   188 $\text{eval}(\text{skip}, E)$ & $\dn$ & $E$\\
   217 % $\text{eval}(\text{skip}, E)$ & $\dn$ & $E$\\
   189 $\text{eval}(x:=a, E)$ & $\dn$ & \bl{$E(x \mapsto \text{eval}(a, E))$}\\
   218 % $\text{eval}(x:=a, E)$ & $\dn$ & \bl{$E(x \mapsto \text{eval}(a, E))$}\\
   190 \multicolumn{3}{@{}l@{}}{$\text{eval}(\text{if}\;b\;\text{then}\;cs_1\;\text{else}\;cs_2 , E) \dn$}\\
   219 % \multicolumn{3}{@{}l@{}}{$\text{eval}(\text{if}\;b\;\text{then}\;cs_1\;\text{else}\;cs_2 , E) \dn$}\\
   191 \multicolumn{3}{@{}l@{}}{\hspace{2cm}$\text{if}\;\text{eval}(b,E)\;\text{then}\;
   220 % \multicolumn{3}{@{}l@{}}{\hspace{2cm}$\text{if}\;\text{eval}(b,E)\;\text{then}\;
   192 \text{eval}(cs_1,E)$}\\
   221 % \text{eval}(cs_1,E)$}\\
   193 \multicolumn{3}{@{}l@{}}{\hspace{2cm}$\phantom{\text{if}\;\text{eval}(b,E)\;}\text{else}\;\text{eval}(cs_2,E)$}\\
   222 % \multicolumn{3}{@{}l@{}}{\hspace{2cm}$\phantom{\text{if}\;\text{eval}(b,E)\;}\text{else}\;\text{eval}(cs_2,E)$}\\
   194 \multicolumn{3}{@{}l@{}}{$\text{eval}(\text{while}\;b\;\text{do}\;cs, E) \dn$}\\
   223 % \multicolumn{3}{@{}l@{}}{$\text{eval}(\text{while}\;b\;\text{do}\;cs, E) \dn$}\\
   195 \multicolumn{3}{@{}l@{}}{\hspace{2cm}$\text{if}\;\text{eval}(b,E)$}\\
   224 % \multicolumn{3}{@{}l@{}}{\hspace{2cm}$\text{if}\;\text{eval}(b,E)$}\\
   196 \multicolumn{3}{@{}l@{}}{\hspace{2cm}$\text{then}\;
   225 % \multicolumn{3}{@{}l@{}}{\hspace{2cm}$\text{then}\;
   197 \text{eval}(\text{while}\;b\;\text{do}\;cs, \text{eval}(cs,E))$}\\
   226 % \text{eval}(\text{while}\;b\;\text{do}\;cs, \text{eval}(cs,E))$}\\
   198 \multicolumn{3}{@{}l@{}}{\hspace{2cm}$\text{else}\; E$}\\
   227 % \multicolumn{3}{@{}l@{}}{\hspace{2cm}$\text{else}\; E$}\\
   199 $\text{eval}(\text{write}\; x, E)$ & $\dn$ & $\{\;\text{println}(E(x))\; ;\;E\;\}$\\
   228 % $\text{eval}(\text{write}\; x, E)$ & $\dn$ & $\{\;\text{println}(E(x))\; ;\;E\;\}$\\
   200 \end{tabular}}
   229 % \end{tabular}}
   201 \end{center}
   230 % \end{center}
   202 
   231 
   203 \end{frame}
   232 % \end{frame}
   204 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
   233 % %%%%%%%%%%%%%%%
   205 
   234 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
   206 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   235 
   207 \begin{frame}[c]
   236 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   208 \frametitle{Test Program}
   237 % \begin{frame}[c]
   209 
   238 % \frametitle{Test Program}
   210 \mbox{}\\[-18mm]\mbox{}
   239 
   211 
   240 % \mbox{}\\[-18mm]\mbox{}
   212 ??
   241 
   213 %{\lstset{language=While}\fontsize{10}{12}\selectfont
   242 % {\lstset{language=While}\fontsize{10}{12}\selectfont
   214 %\texttt{\lstinputlisting{../progs/loops.while}}}
   243 % \texttt{\lstinputlisting{../progs/while-tests/loops.while}}}
   215 
   244 
   216 \end{frame}
   245 % \end{frame}
   217 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
   246 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
   218 
   247 
   219 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   248 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   220 \begin{frame}[c]
   249 % \begin{frame}[c]
   221 \fontsize{7}{9}\selectfont
   250 % \fontsize{7}{9}\selectfont
   222 
   251 
   223 
   252 
   224 \begin{columns}
   253 % \begin{columns}
   225 \begin{column}{7cm} 
   254 % \begin{column}{7cm} 
   226 \lstinputlisting[numbers=none]{../progs/appHa.j}
   255 % \lstinputlisting[numbers=none]{../progs/appHa.j}
   227 \end{column}
   256 % \end{column}
   228 
   257 
   229 \begin{column}{7cm} 
   258 % \begin{column}{7cm} 
   230 \lstinputlisting[numbers=none]{../progs/appHb.j}
   259 % \lstinputlisting[numbers=none]{../progs/appHb.j}
   231 \end{column}
   260 % \end{column}
   232 \end{columns}
   261 % \end{columns}
   233 
   262 
   234 \end{frame}
   263 % \end{frame}
   235 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
   264 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
   236  
   265  
   237 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   266 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   238 %\begin{frame}[t]
   267 %\begin{frame}[t]
   239 %\frametitle{Interpreted Code}
   268 %\frametitle{Interpreted Code}
   240 %
   269 %