Merge branch 'master' of git.martlubbers.net:msc-thesis1617
[msc-thesis1617.git] / mtask.tex
1 The \gls{mTask}-\gls{EDSL} was created by Koopman et al.\ and supports several
2 views such as an \gls{iTasks} simulation and a \gls{C}-code generator. The
3 \gls{EDSL} was designed to generate a ready-to-compile \gls{TOP}-like program
4 for microcontrollers such as the \gls{Arduino}~\cite{koopman_type-safe_nodate}%
5 \cite{plasmeijer_shallow_2016}.
6
7 The \gls{mTask}-\gls{EDSL} is a shallowly embedded class based \gls{EDSL} and
8 therefore it is very suitable to have a new backend that partly implements the
9 classes given. The following sections show the details of the \gls{EDSL} that
10 is used in this extension. The parts of the \gls{EDSL} that are not used will
11 not be discussed and the details of those parts can be found in the cited
12 literature.
13
14 A view for the \gls{mTask}-\gls{EDSL} is a type with two free type
15 variables\footnote{kind \CI{*->*->*}.} that implements some of the classes
16 given. The types do not have to be present as fields in the view and can, and
17 will most often, be exclusively phantom types. Thus, views are of the
18 form: \CI{:: v t r = ...}. The first type variable will be the type of the
19 view. The second type variable will be the type of the \gls{EDSL}-expression
20 and the third type variable represents the role of the expression. Currently
21 the role of the expressions form a hierarchy. The three roles and their
22 hierarchy are shown in Listing~\ref{lst:exprhier}. This implies that everything
23 is a statement, only an \CI{Upd} and an \CI{Expr} are expressions. The \CI{Upd}
24 restriction describes updatable expressions such as \gls{GPIO} pins and
25 \glspl{SDS}. The roles are used to constrain certain classes. For example,
26 without the roles for \CI{Upd}. Assignment would be possible to a
27 non-assignable expression such as a literal integer.
28
29 \begin{lstlisting}[language=Clean,%
30 label={lst:exprhier},caption={Expression role hierarchy}]
31 :: Upd = Upd
32 :: Expr = Expr
33 :: Stmt = Stmt
34
35 class isExpr a :: a -> Int
36 instance isExpr Upd
37 instance isExpr Expr
38 \end{lstlisting}
39
40 \section{Expressions}
41 \input{mtask.expr}
42
43 \section{Control flow}
44 \input{mtask.control}
45
46 \section{Input/Output}
47 \input{mtask.io}
48
49 \section{Class Extensions}
50 \input{mtask.class}
51
52 \section{Scheduling Strategy}
53 \input{mtask.scheduling}
54
55 \section{Example mTask}
56 \input{mtask.examples}