X-Git-Url: https://git.martlubbers.net/?a=blobdiff_plain;ds=inline;f=results.mtask.tex;h=8b0fb20ea551cc3b22c00efbe87392d13c2674cf;hb=7ca87066ed1f3a962d993a9ac32ab761cfdc05a9;hp=18c5a06304bc401fd8a115483553510a2a03ccbe;hpb=c1a2d537de7ff3d730d26658daa822b2f03ea110;p=msc-thesis1617.git diff --git a/results.mtask.tex b/results.mtask.tex index 18c5a06..8b0fb20 100644 --- a/results.mtask.tex +++ b/results.mtask.tex @@ -1,67 +1,50 @@ -\section{mTask} -\subsection{\gls{EDSL}} -%The \gls{mTask}-\gls{EDSL} contains several classes that need to be implemented -%by a type for it to be an \gls{mTask}. For numeric and boolean arithmetic the -%classes \texttt{arith} and \texttt{boolExpr} are available and listed in a -%shortened version in Listing~\ref{lst:arithbool}. All classes are to be -%implemented by types of kind \texttt{*->*->*} a type \texttt{v t p}, -%respectively a view with a type and the role. -% -%\texttt{lit} lifts a constant to the \gls{mTask} domain. For a type to be a -%valid \gls{mTask} type it needs to implement the \texttt{mTaskType} class. The -%binary operators work as expected. +Some functionality of the original \gls{mTask}-\gls{EDSL} will not be used in +this extension \gls{EDSL}. Conversely, some functionality needed was not +available in the existing \gls{EDSL}. Due to the nature of class based shallow +embedding this obstacle is very easy to solve. A type housing the \gls{EDSL} +does not have to implement all the available classes. Moreover, classes can be +added at will without interfering with the existing views. -\begin{lstlisting}[language=Clean,label={lst:arithbool}, - caption={Basic classes for expressions}] +\section{Bytecode compilation view} +The \glspl{mTask} are sent to the device in bytecode and are saved in the +memory of the device. To compile the \gls{EDSL} code to bytecode a \gls{RWST} +is used. The \gls{RWST} is a state transformer stacked on a \emph{Reader} monad +and a \emph{Writer} monad. In this case the transformer part is not used. +However, this can be done to add for example better runtime error handling. + +\begin{lstlisting}[language=Clean] +:: ByteCode a p = BC (RWS () [BC] BCState ()) +:: BCValue = E.e: BCValue e & mTaskType, TC e +:: BCShare = { + sdsi :: Int, + sdsval :: BCValue + } +:: BCState = { + freshl :: [Int], + freshs :: [Int], + sdss :: [BCShare] + } + +class toByteCode a :: a -> String +class fromByteCode a :: String -> a class mTaskType a | toByteCode, fromByteCode, iTask, TC a -class arith v where - lit :: t -> v t Expr | mTaskType t - (+.) infixl 6 :: (v t p) (v t q) -> v t Expr | type, +, zero t & isExpr p & isExpr q - ... -class boolExpr v where - (&.) infixr 3 :: (v Bool p) (v Bool q) -> v Bool Expr | isExpr p & isExpr q - Not :: (v Bool p) -> v Bool Expr | isExpr p - ... - (==.) infix 4 :: (v a p) (v a q) -> v Bool Expr | ==, toCode a & isExpr p & isExpr q +instance toByteCode Int, ... , UserLED, BCValue +instance fromByteCode Int, ... , UserLED, BCValue + +instance arith ByteCode +... +instance serial ByteCode \end{lstlisting} -% -% -%\subsection{Tasks} -% -%\subsection{Shares} -%Shares can live on multiple clients at the same time. For every share created -%for an \gls{mTask} a real \gls{SDS} is created that mirrors the value on the -%client. All shares currently in use are stored in a system-wide \gls{SDS} in -%such a way that the actual share can be retrieved at any moment. All shares -%have a unique numeric identifier and an initial value. -% -%\begin{lstlisting}[language=Clean,label={lst:sharespec}, caption={\acrlong{SDS}}] -%:: BCValue = E.e: BCValue e & mTaskType e -%:: MTaskShareType = MTaskWithShare String | MTaskLens String -%:: MTaskShare = -% {withTask :: [String] -% ,withDevice :: [String] -% ,identifier :: Int -% ,realShare :: MTaskShareType -% ,value :: BCValue -% } -% -%sdsStore :: Shared [MTaskShare] -%\end{lstlisting} -%\todo{Do something with the sharetype} -% -%\subsection{Communication} -%%\todo{Handshake, device specification sending, spec.c} -%%\todo{mTaskDevice class interface} -% -%\section{mTasks} -%\subsection{\gls{EDSL}} -%\todo{Show the classes} -% -%\subsection{Shares} -%\todo{Show the types and why} -% -%Shares are used to store the values -% -%Shares all have + +\section{Bytecode compilation view for \gls{mTask}} +Compilation to bytecode + +\subsection{Backend} +\todo{Aanpassingen +aan de mTask DSL} + +\section{Semantics} + +\todo{Uitleggen wat het systeem precies doet} +