From: Mart Lubbers Date: Sun, 29 Jan 2017 21:17:40 +0000 (+0100) Subject: update praatje X-Git-Url: https://git.martlubbers.net/?a=commitdiff_plain;h=89b5b40960317092a5290d9d5c5a1034cab20707;p=ri1617.git update praatje --- diff --git a/final_review/control.listing b/final_review/control.listing new file mode 100644 index 0000000..1eb974e --- /dev/null +++ b/final_review/control.listing @@ -0,0 +1,14 @@ +:: Main a = {main :: a} +:: UserLED = LED1 | LED2 | LED3 + +class seq v where + (:.) infixr 0 :: (v t p) (v u q) -> v u Stmt | ... +class assign v where + (=.) infixr 2 :: (v t Upd) (v t p) -> v t Expr | type t & isExpr p +class noOp v where noOp :: v t p +class IF v where + IF :: (v Bool p) (v t q) (v s r) -> v () Stmt | isExpr p + (?) infix 1 :: (v Bool p) (v t q) -> v () Stmt | isExpr p +class userLed v where + ledOn :: UserLED -> (v () Stmt) + ledOff :: UserLED -> (v () Stmt) diff --git a/final_review/demo.listing b/final_review/demo.listing index eaeaa9e..7c330c9 100644 --- a/final_review/demo.listing +++ b/final_review/demo.listing @@ -1,18 +1,19 @@ -main = sds \x=1 In sds \pin=1 In - { main = - IF (digitalRead D3) ( - x =. x +. lit 1 :. pub x - ) ( noOp - ) :. - IF (pinnetje ==. lit 1) ( - digitalWrite D0 (lit True) - ) ( IF (pinnetje ==. lit 2) ( - digitalWrite D1 (lit True) - ) ( digitalWrite D2 (lit True) - )) } +bc1 d = {main = ledOn d} +bc2 d = {main = ledOff d} +bc3 = sds \x=1 In sds \pin=1 In {main = + IF (digitalRead D3) ( + x =. x +. lit 1 :. + pub x + ) ( + noOp + ) :. + IF (pin ==. lit 1) ( + ledOn LED1 + ) ( + IF (pin ==. lit 2) ( + ledOn LED2 + ) ( + ledOn LED3 + ) + )} -ledOn :: DigitalPin -> Main (ByteCode () Stmt) -ledOn d = { main = digitalWrite d (lit True) :. noOp } - -ledOff :: DigitalPin -> Main (ByteCode () Stmt) -ledOff d = { main = digitalWrite d (lit False) :. noOp } diff --git a/final_review/edsl.listing b/final_review/edsl.listing new file mode 100644 index 0000000..c47626a --- /dev/null +++ b/final_review/edsl.listing @@ -0,0 +1,14 @@ +:: Upd = Upd +:: Expr = Expr +:: Stmt = Stmt +:: MTask = MTask Int // String + +class arith v where + lit :: t -> v t Expr | ... + (+.) infixl 6 :: (v t p) (v t q) -> v t Expr | ... + ... +class boolExpr v where + (&.) infixr 3 :: (v Bool p) (v Bool q) -> v Bool Expr | ... + ... + (==.) infix 4 :: (v a p) (v a q) -> v Bool Expr | ... + ... diff --git a/final_review/praatje.tex b/final_review/praatje.tex index ae8d826..61cbacd 100644 --- a/final_review/praatje.tex +++ b/final_review/praatje.tex @@ -58,6 +58,27 @@ \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 Communication via SDS + \item Handle communication + \item Synchronize SDS + \end{itemize} + \end{block} +\end{frame} + \begin{frame} \frametitle{mTask} \begin{block}{Properties} @@ -77,17 +98,19 @@ \begin{frame} \frametitle{Bytecode} + \begin{block}{State transformer} + \end{block} \begin{tabular}{rllll} \toprule & \multicolumn{4}{c}{Current instructionset}\\ \midrule Stack: & nop & push & pop\\ - SDSs: & sdsstore & sdsfetch & sdspublish\\ Boolean: & not & and & or\\ Arithmetic: & add & sub & mul & div\\ Compare: & eq,neq & les, gre & leq, geq\\ Control: & jmp & jmpt & jmpf\\ - Aux: & digitalread & digitalwrite & analogread & analogwrite\\ + Aux: & ledOn & ledOff\\ + Aux2: & digitalread & digitalwrite & analogread & analogwrite\\ \midrule \pause% & \multicolumn{4}{c}{Future}\\ @@ -100,66 +123,29 @@ \begin{frame}[fragile] \frametitle{mTask} \framesubtitle{cont.} - \begin{lstlisting}[caption={Simplified DSL classes},language=Clean,basicstyle=\scriptsize] -:: Main a = {main :: a} -:: Upd = Upd -:: Expr = Expr -:: Stmt = Stmt -:: MTask = MTask Int // String - -class arith v where - lit :: t -> v t Expr | ... - (+.) infixl 6 :: (v t p) (v t q) -> v t Expr | ... - ... -class boolExpr v where - (&.) infixr 3 :: (v Bool p) (v Bool q) -> v Bool Expr | ... - ... - (==.) infix 4 :: (v a p) (v a q) -> v Bool Expr | ... - ... - \end{lstlisting} + \lstinputlisting[language=Clean,basicstyle=\scriptsize]{edsl.listing} \end{frame} \begin{frame}[fragile] \frametitle{mTask} \framesubtitle{cont.} - \begin{lstlisting}[caption={Control and auxilary},language=Clean,basicstyle=\scriptsize] -:: In a b = In infix 0 a b - -class seq v where - (:.) infixr 0 :: (v t p) (v u q) -> v u Stmt | ... -class sds v where - sds :: ((v t Upd)->In t (Main (v c s))) -> (Main (v c s)) | ... - pub :: (v t Upd) -> v t Expr | type t -class assign v where - (=.) infixr 2 :: (v t Upd) (v t p) -> v t Expr | type t & isExpr p -class noOp v where noOp :: v t p -class IF v where - IF :: (v Bool p) (v t q) (v s r) -> v () Stmt | isExpr p - (?) infix 1 :: (v Bool p) (v t q) -> v () Stmt | isExpr p -class digitalIO v where - digitalRead :: p -> v Bool Expr | pin, readPinD p - digitalWrite :: p (v Bool q) -> v Bool Expr | pin, writePinD p -class analogIO v where - analogRead :: AnalogPin -> v Int Expr - analogWrite :: AnalogPin (v Int p) -> v Int Expr - \end{lstlisting} -\end{frame} - -\begin{frame}[fragile] - \frametitle{mTask} - \framesubtitle{cont.} - \begin{lstlisting}[caption={To implement},language=Clean,basicstyle=\scriptsize] -class fun v t where - fun :: ((t->v s Expr)->In (t->v s p) (Main (v u q))) -> Main (v u q) | type s -class time v where - delay :: (v Long p) -> (v Long Expr) - millis :: (v Long Expr) - \end{lstlisting} + \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] @@ -172,12 +158,17 @@ class time v where \begin{frame} \frametitle{Future} - \begin{itemize} + \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} diff --git a/final_review/sds.listing b/final_review/sds.listing new file mode 100644 index 0000000..f034707 --- /dev/null +++ b/final_review/sds.listing @@ -0,0 +1,4 @@ +:: In a b = In infix 0 a b +class sds v where + sds :: ((v t Upd)->In t (Main (v c s))) -> (Main (v c s)) | ... + pub :: (v t Upd) -> v t Expr | type t