\documentclass{beamer}

\usepackage{xcolor}
\usepackage{listings}
\usepackage{clean}

\title[cc1516: Semantic analysis]{SPLC}
\subtitle{\texttt{<splc>~::= <spl> <parser> `,' <lexer> `and' <compiler>}}
\author[P. Jager, M. Lubbers]{Pim Jager\inst{1}\and Mart Lubbers\inst{1}}
\institute[Radboud University]{%
	\inst{1}%
	Computer Science: Software Science\\
	Radboud University
}
\subject{Code generation}
\date{\today}

\lstset{%
	basicstyle=\ttfamily\footnotesize,
	breaklines
}

\usetheme{Warsaw}
\usecolortheme{beaver}

\begin{document}
\frame{\titlepage}

\begin{frame}[fragile]
	\frametitle{\textsc{SPLC}}
	\begin{block}{Features}
		\begin{itemize}
			\item Implementation language:
				Clean ({\tiny\url{http://clean.cs.ru.nl}})
			\item Type checking and type inference
%			\item No multiple recursion\ldots\pause\ yet\ldots\pause%
			\item Higher order functions
		\end{itemize}
	\end{block}
	\begin{block}{Changes}
		\begin{lstlisting}
gen.dcl              |   6 +
gen.icl              | 221 ++++++++++++++
grammar/grammar.txt  |  19 +-
parse.icl            |  39 ++-
sem.dcl              |  10 +-
sem.icl              | 676 ++++++++++++++++++++++++------------------
spl.icl              |  35 ++-
		\end{lstlisting}
	\end{block}
\end{frame}

\begin{frame}
	\frametitle{Progress since previous presentation}
	\begin{itemize}[<+->]
		\item Completely redid typechecking and inference
		\item Extended semantic analysis with
			\begin{itemize}[<+->]
				\item Complain when unknown functions are used
				\item Complain when there is no main
				\item Complain when \CI{Void} is used as a non terminal type
				\item Complain when duplicate functions are used
				\item Complain when the main is not of the correct form
			\end{itemize}
		\item Higher order functions
		\item Code generation for expressions
		\item A lot needs to be done\ldots
	\end{itemize}
\end{frame}

\begin{frame}[fragile]
	\frametitle{Type checking}
	\begin{block}{Two pass}
		\begin{itemize}
			\item Constraint collecting
			\item Constraint satisfaction
		\end{itemize}
	\end{block}
	\pause%
	\begin{block}{\CI{RWST}}
		\begin{CleanCode}
:: Scheme = Forall [TVar] Type
:: Gamma :== Map String Scheme
:: Typing a :== StateT (Gamma, [TVar]) (Either SemError) a
:: Substitution :== `Map'.Map TVar Type
:: Constraints :== [(Type, Type)]
:: SemError
		\end{CleanCode}
	\end{block}
\end{frame}

\begin{frame}[fragile]
	\frametitle{Code generation}
	\begin{block}{}
		\begin{CleanCode}
:: SSMProgram :== [Instr]
:: Instr    = Instr String [Arg] String
            | Lab Label
:: Label :== String
:: Arg = L Label | Lit Int | Raw String
:: GenError = Error String
:: GenMap :== Map String LoadPlace
:: LoadPlace    = LDA Int | LDC Int | LDH Int | LDL Int 
                | LDR Int | LDS Int
                | FUNC Label
		\end{CleanCode}
	\end{block}
	\pause%
	\begin{block}{\CI{RWST} we meet again}
		\begin{CleanCode}
:: Gen a :== RWST () SSMProgram (GenMap, [Label]) (Either GenError) a
		\end{CleanCode}
	\end{block}
\end{frame}

\begin{frame}[fragile]
	\frametitle{Future}
	\begin{block}{Higher order functions}
		Read up on how to implement higher order functions
	\end{block}
	\pause%
	\begin{block}{Hand in hand with code generation}
		To get a fully working compiler and report before the deadline
	\end{block}
\end{frame}
\end{document}
