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