add class based dsl part
[msc-thesis1617.git] / methods.tex
1 \input{methods.top.tex}
2
3 \input{methods.dsl.tex}
4
5 \input{methods.arch.tex}
6
7 \section{mTasks}
8 \subsection{\gls{EDSL}}
9 The \gls{mTask}-\gls{EDSL} contains several classes that need to be implemented
10 by a type for it to be an \gls{mTask}. For numeric and boolean arithmetic the
11 classes \texttt{arith} and \texttt{boolExpr} are available and listed in a
12 shortened version in Listing~\ref{lst:arithbool}. All classes are to be
13 implemented by types of kind \texttt{*->*->*} a type \texttt{v t p},
14 respectively a view with a type and the role.
15
16 \texttt{lit} lifts a constant to the \gls{mTask} domain. For a type to be a
17 valid \gls{mTask} type it needs to implement the \texttt{mTaskType} class. The
18 binary operators work as expected.
19
20 \begin{lstlisting}[language=Clean,label={lst:arithbool},
21 caption={Basic classes for expressions}]
22 class mTaskType a | toByteCode, fromByteCode, iTask, TC a
23
24 class arith v where
25 lit :: t -> v t Expr | mTaskType t
26 (+.) infixl 6 :: (v t p) (v t q) -> v t Expr | type, +, zero t & isExpr p & isExpr q
27 ...
28 class boolExpr v where
29 (&.) infixr 3 :: (v Bool p) (v Bool q) -> v Bool Expr | isExpr p & isExpr q
30 Not :: (v Bool p) -> v Bool Expr | isExpr p
31 ...
32 (==.) infix 4 :: (v a p) (v a q) -> v Bool Expr | ==, toCode a & isExpr p & isExpr q
33 \end{lstlisting}
34
35
36 \subsection{Tasks}
37
38 \subsection{Shares}
39 Shares can live on multiple clients at the same time. For every share created
40 for an \gls{mTask} a real \gls{SDS} is created that mirrors the value on the
41 client. All shares currently in use are stored in a system-wide \gls{SDS} in
42 such a way that the actual share can be retrieved at any moment. All shares
43 have a unique numeric identifier and an initial value.
44
45 \begin{lstlisting}[language=Clean,label={lst:sharespec}, caption={\acrlong{SDS}}]
46 :: BCValue = E.e: BCValue e & mTaskType e
47 :: MTaskShareType = MTaskWithShare String | MTaskLens String
48 :: MTaskShare =
49 {withTask :: [String]
50 ,withDevice :: [String]
51 ,identifier :: Int
52 ,realShare :: MTaskShareType
53 ,value :: BCValue
54 }
55
56 sdsStore :: Shared [MTaskShare]
57 \end{lstlisting}
58 \todo{Do something with the sharetype}
59
60 \subsection{Communication}
61 %\todo{Handshake, device specification sending, spec.c}
62 %\todo{mTaskDevice class interface}
63
64 \section{mTasks}
65 \subsection{\gls{EDSL}}
66 \todo{Show the classes}
67
68 \subsection{Shares}
69 \todo{Show the types and why}
70
71 Shares are used to store the values
72
73 Shares all have