%&praatje
\begin{document}
\begin{frame}
	\maketitle
\end{frame}

\begin{frame}
	\frametitle{Who am I?}
	\begin{itemize}
		\item Mart Lubbers
		\item Bachelor Artificial Intelligence
		\item Master Software Science
		\item Research internship (15ECTS)
		\item FP, compilers, iTasks
	\end{itemize}
\end{frame}

\begin{frame}
	\frametitle{Combine levels}
	\begin{columns}[t]
		\column{.5\textwidth}
		\begin{block}{High level}
			\begin{itemize}
				\item iTasks
				\item Workflow
				\item Dataflow
			\end{itemize}
		\end{block}
	
		\pause%

		\begin{block}{Low level}
			\begin{itemize}
				\item Microcontrollers
				\item Sensors
				\item Actuators
				\item Low bandwidth
				\item Low power
				\item Low processing power
			\end{itemize}
		\end{block}

		\column{.5\textwidth}

		\pause%

		\begin{block}{Combine the both worlds}
			\begin{itemize}
				\item Type-safe EDSL
				\item Byte-compiled on the fly
				\item Interpreted on the client
				\item One codebase for different clients
				\item GSM, Bluetooth, Serial, TCP, \ldots
				\pause%
				\item mTasks
			\end{itemize}
		\end{block}
	\end{columns}
\end{frame}

\begin{frame}
	\frametitle{Architecture}
	\begin{block}{Client}
		\begin{itemize}
			\item C code
			\item Round robin scheduling
			\item Check input, run tasks, sleep
			\item Interval or one-shot
		\end{itemize}
	\end{block}

	\begin{block}{Server}
		\begin{itemize}
			\item iTasks
			\item Mothertask
			\item Communication via SDS
			\item Handle communication
			\item Synchronize SDS
		\end{itemize}
	\end{block}
\end{frame}

\begin{frame}
	\frametitle{mTask}
	\begin{block}{Properties}
		\begin{itemize}
			\item Initially developed by Pieter Koopman
			\item Designed to simulate TOP on microcontrollers
			\item Type safe
			\item Shallowly embedded
			\item Class based and thus extendable with views
			\pause%
			\item Current views: Simulation in iTasks, C code generation
			\pause%
			\item New view: Bytecode compilation.
		\end{itemize}
	\end{block}
\end{frame}

\begin{frame}
	\frametitle{Bytecode}
	\begin{block}{State transformer}
	\end{block}
	\begin{tabular}{rllll}
		\toprule
		& \multicolumn{4}{c}{Current instructionset}\\
		\midrule
		Stack: & nop & push & pop\\
		Boolean: & not & and & or\\
		Arithmetic: & add & sub & mul & div\\
		Compare: & eq,neq & les, gre & leq, geq\\
		Control: & jmp & jmpt & jmpf\\
		Aux: & ledOn & ledOff\\
		Aux2: & digitalread & digitalwrite & analogread & analogwrite\\
		\midrule
		\pause%
		& \multicolumn{4}{c}{Future}\\
		\midrule
		Aux extensions: & LCD & Serial & Shields\\
		\bottomrule
	\end{tabular}
\end{frame}

\begin{frame}[fragile]
	\frametitle{mTask}
	\framesubtitle{cont.}
	\lstinputlisting[language=Clean,basicstyle=\scriptsize]{edsl.listing}
\end{frame}

\begin{frame}[fragile]
	\frametitle{mTask}
	\framesubtitle{cont.}
	\lstinputlisting[language=Clean,basicstyle=\scriptsize]{control.listing}
\end{frame}

\begin{frame}
	\frametitle{SDS}
	\lstinputlisting[language=Clean,basicstyle=\scriptsize]{sds.listing}
	\pause%
	\begin{itemize}
		\item Pushed from server to client
		\item Client has to specifically publish
		\item Synchronized with a real SDS by the connection handlers
		\item \CI{get}, \CI{set} and no \CI{upd}
	\end{itemize}
	\pause%
	\begin{block}{Bytecode}
		sdsstore, sdsfetch, sdspublish
	\end{block}
\end{frame}

\begin{frame}[fragile]
	\frametitle{Demo}
	\lstinputlisting[%
		caption={mTasks used in the demo},
		language=Clean,
		basicstyle=\scriptsize]{demo.listing}
\end{frame}

\begin{frame}
	\frametitle{Future}
	\begin{itemize}[<+->]
		\item Task combinators
		\item Functions
		\item Seamless integration with iTasks
		\item Dynamic mTask/SDS allocation
		\item Better integration with real SDS
		\item More datatypes for SDS
		\item Slicing tasks
		\item Support for different devices
		\item Master's Thesis
		\item \ldots
	\end{itemize}
\end{frame}

\end{document}
