From: Mart Lubbers Date: Thu, 6 Jul 2017 18:26:45 +0000 (+0200) Subject: update, not working, commit before revamp thesis X-Git-Tag: final~29 X-Git-Url: https://git.martlubbers.net/?a=commitdiff_plain;h=ffa6430226fea060cd798edd2cce1884f5488a73;p=msc-thesis1617.git update, not working, commit before revamp thesis --- diff --git a/pres.system.tex b/pres.system.tex index 90c4c46..4c8b2fb 100644 --- a/pres.system.tex +++ b/pres.system.tex @@ -17,6 +17,7 @@ \item Interpreter on client \item Server in iTasks with integration \item No taskserver generation, onetime programming + \item Explicit SDS publishing \end{itemize} \end{block} \end{frame} @@ -26,6 +27,7 @@ \frametitle{Adding a View} \begin{lstlisting} :: ByteCode a p = BC (RWS () [BC] BCState ()) +:: BC = BCNop | BCPush BCValue | ... :: BCValue = E.e: BCValue e & mTaskType, TC e :: BCShare = { sdsi :: Int, sdsval :: BCValue, sdsname :: String } :: BCState = { freshl :: Int, freshs :: Int, sdss :: [BCShare] } @@ -34,6 +36,52 @@ instance ByteCode arith, boolExpr, ... \end{lstlisting} \end{frame} +\begin{frame}[fragile] + \frametitle{Implementation} + \begin{itemize} + \item Writing instruction + \item Carrying state + \item Hand-crafted helpers + \end{itemize} + \begin{lstlisting} +op2 :: (ByteCode a p1) (ByteCode a p2) BC -> ByteCode b Expr +op2 (BC x) (BC y) bc = BC (x >>| y >>| tell [bc]) + +tell2 :: [BC] -> (ByteCode a p) +tell2 x = BC (tell x) + +instance arith ByteCode where + lit x = tell2 [BCPush (BCValue x)] + (+.) x y = op2 x y BCDiv + ... + \end{lstlisting} +\end{frame} + +\begin{frame}[fragile] + \frametitle{Control flow} + \begin{itemize} + \item Use labels + \item Label resolving + \pause{} + \item Thus no reuse + \end{itemize} + \pause{} + \begin{lstlisting} +:: BC = ... | BCLab Int | ... + +freshlabel = get >>= \st=:{freshl}->put {st & freshl=freshl+1} >>| pure freshl + +instance If ByteCode Stmt Stmt Stmt where If b t e = BCIfStmt b t e +... +BCIfStmt (BC b) (BC t) (BC e) = BC ( + freshlabel >>= \else->freshlabel >>= \endif-> + b >>| tell [BCJmpF else] >>| + t >>| tell [BCJmp endif, BCLab else] >>| + e >>| tell [BCLab endif] + ) + \end{lstlisting} +\end{frame} + \begin{frame}[fragile] \frametitle{Functionality} \begin{block}{SDS scope and naming} @@ -41,6 +89,7 @@ instance ByteCode arith, boolExpr, ... \item SDS is lost \item State per device \item Tasks are sent and gone + \item Save bandwidth \end{itemize} \pause{} \begin{lstlisting} @@ -48,10 +97,32 @@ class namedsds v where namedsds :: ((v t Upd) -> In (Named t String) (Main (v c s))) -> (Main (v c s)) | ... :: Named a b = Named infix 1 a b + +instance sdspub ByteCode where + pub (BC x) = BC (censor (\[BCSdsFetch s]->[BCSdsPublish s]) x) \end{lstlisting} \end{block} \end{frame} +\begin{frame}[fragile] + \frametitle{Assignment} + \begin{lstlisting} +instance sds ByteCode where + sds f = {main = BC (freshshare + >>= \sdsi->pure {BCShare|sdsname="",sdsi=sdsi,sdsval=BCValue 0} + >>= \sds->pure (f (tell2 [BCSdsFetch sds])) + >>= \(v In bdy)->modify (addSDS sds v) + >>| unBC (unMain bdy)) + } + +instance assign ByteCode where + (=.) (BC v) (BC e) = BC (e >>| censor makeStore v) + +makeStore [BCSdsFetch i] = [BCSdsStore i] +makeStore [BCDigitalRead i] = [BCDigitalWrite i] +makeStore [...] = [...] + \end{lstlisting} +\end{frame} \begin{frame}[fragile] \frametitle{Task scheduling} \begin{block}{Old} @@ -82,6 +153,22 @@ class retrn v where \end{block} \end{frame} +\subsection{Interpretation} +\begin{frame}[fragile] + \frametitle{mTask implementation} + %TODO +\end{frame} + \subsection{Devices} +\begin{frame} + \frametitle{Devices} + \begin{itemize} + \item Standard C + \item Implement some classes in interface + \pause{} + \item How to handle termination + \end{itemize} +\end{frame} + \subsection{Server} \subsection{Examples}