From: Mart Lubbers Date: Thu, 6 Jul 2017 11:07:08 +0000 (+0200) Subject: elaborate on mtasks X-Git-Tag: final~30 X-Git-Url: https://git.martlubbers.net/?a=commitdiff_plain;h=ef5c1079e97c0cf6c13d4e98d79a0beb1a917473;p=msc-thesis1617.git elaborate on mtasks --- diff --git a/pres.mtask.tex b/pres.mtask.tex index bdc529a..ef80aaf 100644 --- a/pres.mtask.tex +++ b/pres.mtask.tex @@ -173,3 +173,82 @@ class boolExpr v where (==.) infix 4 :: (v a p) (v a q) -> v Bool Expr | ... \end{lstlisting} \end{frame} + +\begin{frame}[fragile] + \frametitle{Control flow} + \begin{lstlisting} +class If v q r ~s where + If :: (v Bool p) (v t q) (v t r) -> v t s | ... + +class IF v where + IF :: (v Bool p) (v t q) (v s r) -> v () Stmt | ... + (?) infix 1 :: (v Bool p) (v t q) -> v () Stmt | ... + +instance If Code Stmt Stmt Stmt +instance If Code e Stmt Stmt +instance If Code Stmt e Stmt +instance If Code x y Expr + +class seq v where + (:.) infixr 0 :: (v t p) (v u q) -> v u Stmt | ... + \end{lstlisting} +\end{frame} + +\begin{frame}[fragile] + \frametitle{Assignment and Input/Output} + \begin{lstlisting} +:: DigitalPin = D0 | D1 | D2 ... +:: AnalogPin = A0 | A1 | A2 ... + +class dIO v where dIO :: DigitalPin -> v Bool Upd +class aIO v where aIO :: AnalogPin -> v Int Upd + +class analogRead v where + analogRead :: AnalogPin -> v Int Expr + analogWrite :: AnalogPin (v Int p) -> v Int Expr + +class digitalRead v where + digitalRead :: DigitalPin -> v Bin Expr + digitalWrite :: DigitalPin (v Bool p) -> v Int Expr + \end{lstlisting} +\end{frame} + +\begin{frame}[fragile] + \frametitle{Shared Data Sources and Assignment} + \begin{lstlisting} +:: In a b = In infix 0 a b +:: Main a = {main :: a} + +class sds v where + sds :: ((v t Upd)->In t (Main (v c s))) -> (Main (v c s)) | ... + +class assign v where + (=.) infixr 2 :: (v t Upd) (v t p) -> v t Expr | ... + \end{lstlisting} +\end{frame} + +\begin{frame}[fragile] + \frametitle{Examples} + \begin{lstlisting} +blink = task \blink=(\x. + IF (x ==. lit True) + (ledOn led) + (ledOff led) :. + blink (lit 1000) (Not x)) + In {main=blink (lit 1000) True} + +thermostat :: Main (View () Stmt) +thermostat = {main = IF (analogRead A0 >. lit 50) + ( digitalWrite D0 (lit True) ) + ( digitalWrite D0 (lit False) ) + } + +thermostat2 :: Main (View () Stmt) +thermostat2 = let a0 = aIO A0 + d0 = dIO D0 + in {main = IF (a0 >. lit 50) + (d0 =. lit True) + (d0 =. lit False) + } + \end{lstlisting} +\end{frame} diff --git a/pres.system.tex b/pres.system.tex index 505e2a9..90c4c46 100644 --- a/pres.system.tex +++ b/pres.system.tex @@ -15,10 +15,8 @@ \begin{itemize}[<+->] \item New bytecode backend for mTask \item Interpreter on client - \item Server in iTasks - \item Integration with iTasks - \item No taskserver generation - \item Program only once + \item Server in iTasks with integration + \item No taskserver generation, onetime programming \end{itemize} \end{block} \end{frame} diff --git a/presentation.tex b/presentation.tex index dd2861c..6698d69 100644 --- a/presentation.tex +++ b/presentation.tex @@ -11,7 +11,7 @@ \section{Introduction} \input{pres.intro} -\section{mTask} +\section{EDSLs \& mTask} \input{pres.mtask} \section{System Overview}