new layout
[msc-thesis1617.git] / methods.mtask.tex
index 837933d..941d95e 100644 (file)
@@ -1,15 +1,15 @@
 \section{mTask}
 The \gls{mTask}-\gls{EDSL} is the basis on which the system is built. The
 \section{mTask}
 The \gls{mTask}-\gls{EDSL} is the basis on which the system is built. The
-\gls{mTask} was created by Koopman et al.\ to support several views such as an
-\gls{iTasks} simulation and a \gls{C}-code generator. The \gls{EDSL} was
-designed to generate a ready to compile \gls{TOP}-like system for
+\gls{mTask}-\gls{EDSL} was created by Koopman et al.\ to support several views
+such as an \gls{iTasks} simulation and a \gls{C}-code generator. The \gls{EDSL}
+was designed to generate a ready to compile \gls{TOP}-like system for
 microcontrollers such as the Arduino\cite{koopman_type-safe_nodate}%
 \cite{plasmeijer_shallow_2016}.
 
 The \gls{mTask}-\gls{EDSL} is a shallowly embedded class based \gls{EDSL} and
 therefore it is very suitable to have a new backend that partly implements the
 given classes. The following subsections show the details of the \gls{EDSL}
 microcontrollers such as the Arduino\cite{koopman_type-safe_nodate}%
 \cite{plasmeijer_shallow_2016}.
 
 The \gls{mTask}-\gls{EDSL} is a shallowly embedded class based \gls{EDSL} and
 therefore it is very suitable to have a new backend that partly implements the
 given classes. The following subsections show the details of the \gls{EDSL}
-that are used in the extension. The parts of the \gls{EDSL} that are not used
+that are used in this extension. The parts of the \gls{EDSL} that are not used
 will not be discussed and the details of those parts can be found in the cited
 literature.
 
 will not be discussed and the details of those parts can be found in the cited
 literature.
 
@@ -36,6 +36,13 @@ instance isExpr Upd
 instance isExpr Expr
 \end{lstlisting}
 
 instance isExpr Expr
 \end{lstlisting}
 
+\subsection{Semantics}
+\gls{mTask} do not behave like functions but more like
+\gls{iTasks}-\glspl{Task}. When an \gls{mTask} is created it returns immediatly
+and the \gls{Task} will be executed sometime in the future. \glspl{Task} can
+run at an interval and they can start other tasks.
+\todo{Meer uitwijden over de mTask semantiek}
+
 \subsection{Expressions}
 Expressions in the \gls{mTask}-\gls{EDSL} are divided into two types, namely
 boolean expressions and arithmetic expressions. The class of arithmetic
 \subsection{Expressions}
 Expressions in the \gls{mTask}-\gls{EDSL} are divided into two types, namely
 boolean expressions and arithmetic expressions. The class of arithmetic
@@ -61,7 +68,24 @@ class boolExpr v where
 \end{lstlisting}
 
 \subsection{Control flow}
 \end{lstlisting}
 
 \subsection{Control flow}
-\todo{Write this}
+Looping of \glspl{Task} happens because \glspl{Task} are launched at regular
+intervals or relaunch themselves. Therefore there is no need for loop control
+flow functionality such as \CI{While} or \CI{For} constructions. The main
+control flow is the sequence operator and the \CI{If} statement. Both are shown
+in Listing~\ref{lst:control}. The first class of \CI{If} statements describe
+the regular if statement. The expressions given can have any role. The
+functional dependency on \CI{s} determines the return type of the statement.
+The sequence operator is very straightforward and just ties the two expressions
+together in sequence.
+
+\begin{lstlisting}[%
+       language=Clean,label={lst:control},caption={Control flow operators}]
+class If v q r ~s where
+  If :: (v Bool p) (v t q) (v t r) -> v t s | ...
+
+class seq v where
+  (:.) infixr 0 :: (v t p) (v u q) -> v u Stmt | ...
+\end{lstlisting}
 
 \subsection{Input/Output and class extensions}
 All expressions that have an \CI{Upd} role can be assigned to. Examples of such
 
 \subsection{Input/Output and class extensions}
 All expressions that have an \CI{Upd} role can be assigned to. Examples of such