--- a/slides/slides06.tex Tue Nov 06 00:48:53 2018 +0000
+++ b/slides/slides06.tex Tue Nov 06 08:18:53 2018 +0000
@@ -110,7 +110,8 @@
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{frame}[c]
-
+\frametitle{Parser Combinators}
+
Atomic parsers, for example
\begin{center}
@@ -520,7 +521,7 @@
\end{tikzpicture}
\end{center}
-We have lexer and parser.
+We have a lexer and a parser\ldots
\end{frame}
@@ -529,19 +530,19 @@
\begin{center}
\bl{\begin{tabular}{@{}lcl@{}}
-\textit{Stmt} & $::=$ & $\texttt{skip}$\\
- & $|$ & \textit{Id}\;\texttt{:=}\;\textit{AExp}\\
- & $|$ & \texttt{if}\; \textit{BExp} \;\texttt{then}\; \textit{Block} \;\texttt{else}\; \textit{Block}\\
- & $|$ & \texttt{while}\; \textit{BExp} \;\texttt{do}\; \textit{Block}\\
+\meta{Stmt} & $::=$ & $\texttt{skip}$\\
+ & $|$ & \textit{Id}\;\texttt{:=}\;\meta{AExp}\\
+ & $|$ & \texttt{if}\; \meta{BExp} \;\texttt{then}\; \meta{Block} \;\texttt{else}\; \meta{Block}\\
+ & $|$ & \texttt{while}\; \meta{BExp} \;\texttt{do}\; \meta{Block}\\
& $|$ & \texttt{read}\;\textit{Id}\\
& $|$ & \texttt{write}\;\textit{Id}\\
& $|$ & \texttt{write}\;\textit{String}\medskip\\
-\textit{Stmts} & $::=$ & \textit{Stmt} \;\texttt{;}\; \textit{Stmts}\\
- & $|$ & \textit{Stmt}\medskip\\
-\textit{Block} & $::=$ & \texttt{\{}\,\textit{Stmts}\,\texttt{\}}\\
- & $|$ & \textit{Stmt}\medskip\\
-\textit{AExp} & $::=$ & \ldots\\
-\textit{BExp} & $::=$ & \ldots\\
+\meta{Stmts} & $::=$ & \meta{Stmt} \;\texttt{;}\; \meta{Stmts}\\
+ & $|$ & \meta{Stmt}\medskip\\
+\meta{Block} & $::=$ & \texttt{\{}\,\meta{Stmts}\,\texttt{\}}\\
+ & $|$ & \meta{Stmt}\medskip\\
+\meta{AExp} & $::=$ & \ldots\\
+\meta{BExp} & $::=$ & \ldots\\
\end{tabular}}
\end{center}
\end{frame}
@@ -558,9 +559,8 @@
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-\mode<presentation>{
\begin{frame}[c]
-\frametitle{\begin{tabular}{c}An Interpreter\end{tabular}}
+\frametitle{An Interpreter}
\begin{center}
\bl{\begin{tabular}{l}
@@ -579,13 +579,12 @@
\end{itemize}
-\end{frame}}
+\end{frame}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-\mode<presentation>{
\begin{frame}[c]
-\frametitle{\begin{tabular}{c}Interpreter\end{tabular}}
+\frametitle{An Interpreter}
\begin{center}
\bl{\begin{tabular}{@{}lcl@{}}
@@ -600,12 +599,12 @@
\end{tabular}}
\end{center}
-\end{frame}}
+\end{frame}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-\mode<presentation>{
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{frame}[c]
-\frametitle{\begin{tabular}{c}Interpreter (2)\end{tabular}}
+\frametitle{An Interpreter (2)}
\begin{center}
\bl{\begin{tabular}{@{}lcl@{}}
@@ -624,7 +623,7 @@
\end{tabular}}
\end{center}
-\end{frame}}
+\end{frame}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -673,6 +672,50 @@
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\begin{frame}[c]
+ \frametitle{Coursework: MkEps}
+
+\begin{center}
+\begin{tabular}{@ {}l@ {\hspace{2mm}}c@ {\hspace{2mm}}l@ {}}
+ \bl{$mkeps([c_1 c_2 \ldots c_n])$} & \bl{$\dn$} & $\bl{undefined}$\\
+ \bl{$mkeps(r^*)$} & \bl{$\dn$} & $\bl{Stars\,[]}$\\
+ \bl{$mkeps(r^{\{n\}})$} & \bl{$\dn$} & $\bl{Stars\,(mkeps(r))^n}$\\
+ \bl{$mkeps(r^{\{n..\}})$} & \bl{$\dn$} & $\bl{Stars\,(mkeps(r))^n}$\\
+ \bl{$mkeps(r^{\{..n\}})$} & \bl{$\dn$} & $\bl{Stars\,[]}$\\
+ \bl{$mkeps(r^{\{n..m\}})$} & \bl{$\dn$} & $\bl{Stars\,(mkeps(r))^n}$\medskip\\
+
+ \bl{$mkeps(r^+)$} & \bl{$\dn$} & \bl{$mkeps(r^{\{1..\}})$}\\
+ \bl{$mkeps(r^?)$} & \bl{$\dn$} & \bl{$mkeps(r^{\{..1\}})$}\\
+\end{tabular}
+\end{center}
+
+\end{frame}
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\begin{frame}[c]
+ \frametitle{Coursework: Inj}
+
+\begin{center}
+\begin{tabular}{@ {}l@ {\hspace{2mm}}c@ {\hspace{2mm}}l@ {}}
+ \bl{$inj([c_1 c_2 \ldots c_n])\,c\,Empty$} & \bl{$\dn$} & $\bl{Chr\,c}$\\
+ \bl{$inj(r^*)\,c\;(Seq\,v\,(Stars\,vs))$} & \bl{$\dn$} & $\bl{Stars\,(inj\,r\,c\,v::vs)}$\\
+ \bl{$inj(r^{\{n\}})\,c\;(Seq\,v\,(Stars\,vs))$} & \bl{$\dn$} & $\bl{Stars\,(inj\,r\,c\,v::vs)}$\\
+ \bl{$inj(r^{\{n..\}})\,c\;(Seq\,v\,(Stars\,vs))$} & \bl{$\dn$} & $\bl{Stars\,(inj\,r\,c\,v::vs)}$\\
+ \bl{$inj(r^{\{..n\}})\,c\;(Seq\,v\,(Stars\,vs))$} & \bl{$\dn$} & $\bl{Stars\,(inj\,r\,c\,v::vs)}$\\
+ \bl{$inj(r^{\{n..m\}})\,c\;(Seq\,v\,(Stars\,vs))$} & \bl{$\dn$} & $\bl{Stars\,(inj\,r\,c\,v::vs)}$\medskip\\
+
+ \bl{$inj(r^+)\,c\,v$} & \bl{$\dn$} & \bl{$inj(r^{\{1..\}})\,c\,v$}\\
+ \bl{$inj(r^?)\,c\,v$} & \bl{$\dn$} & \bl{$inj(r^{\{..1\}})\,c\,v$}\\
+\end{tabular}
+\end{center}
+
+\end{frame}
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+
+
\end{document}
%%% Local Variables: