1 Some functionality of the original
\gls{mTask
}-
\gls{EDSL
} will not be used in
2 this extension
\gls{EDSL
}. Conversely, some functionality needed was not
3 available in the existing
\gls{EDSL
}. Due to the nature of class based shallow
4 embedding this obstacle is very easy to solve. A type housing the
\gls{EDSL
}
5 does not have to implement all the available classes. Moreover, classes can be
6 added at will without interfering with the existing views.
8 \section{Bytecode compilation view
}
9 The
\glspl{mTask
} are sent to the device in bytecode and are saved in the
10 memory of the device. To compile the
\gls{EDSL
} code to bytecode a
\gls{RWST
}
11 is used. The
\gls{RWST
} is a state transformer stacked on a
\emph{Reader
} monad
12 and a
\emph{Writer
} monad. In this case the transformer part is not used.
13 However, this can be done to add for example better runtime error handling.
15 \begin{lstlisting
}[language=Clean
]
16 :: ByteCode a p = BC (RWS ()
[BC
] BCState ())
17 :: BCValue = E.e: BCValue e & mTaskType, TC e
28 class toByteCode a :: a -> String
29 class fromByteCode a :: String -> a
30 class mTaskType a | toByteCode, fromByteCode, iTask, TC a
32 instance toByteCode Int, ... , UserLED, BCValue
33 instance fromByteCode Int, ... , UserLED, BCValue
35 instance arith ByteCode
37 instance serial ByteCode
40 \section{Bytecode compilation view for
\gls{mTask
}}
41 Compilation to bytecode
49 \todo{Uitleggen wat het systeem precies doet
}