:: ByteCode a p = BC (RWS () [BC] BCState ())
:: BCValue = E.e: BCValue e & mTaskType, TC e
:: BCShare =
:: ByteCode a p = BC (RWS () [BC] BCState ())
:: BCValue = E.e: BCValue e & mTaskType, TC e
:: BCShare =
program memory addresses in the final step of compilation to save instructions
and avoid label lookups at runtime.
program memory addresses in the final step of compilation to save instructions
and avoid label lookups at runtime.
\CI{tell`} function is a wrapper around the \gls{RWST} function \CI{tell} that
appends the argument to the \emph{Writer} value.
\CI{tell`} function is a wrapper around the \gls{RWST} function \CI{tell} that
appends the argument to the \emph{Writer} value.
op2 :: (ByteCode a p1) (ByteCode a p2) BC -> ByteCode b Expr
op2 (BC x) (BC y) bc = BC (x >>| y >>| tell [bc])
op2 :: (ByteCode a p1) (ByteCode a p2) BC -> ByteCode b Expr
op2 (BC x) (BC y) bc = BC (x >>| y >>| tell [bc])
Bytecode view implementation for arithmetic and peripheral classes}]
instance arith ByteCode where
lit x = tell` [BCPush (BCValue x)]
Bytecode view implementation for arithmetic and peripheral classes}]
instance arith ByteCode where
lit x = tell` [BCPush (BCValue x)]
that multiple labels appear consecutively in the code. This is not a problem
since the labels are resolved to real addresses later on anyway.
that multiple labels appear consecutively in the code. This is not a problem
since the labels are resolved to real addresses later on anyway.
caption={Bytecode view for the \texttt{IF} class}]
freshlabel = get >>= \st=:{freshl}->put {st & freshl=freshl+1} >>| tell freshl
caption={Bytecode view for the \texttt{IF} class}]
freshlabel = get >>= \st=:{freshl}->put {st & freshl=freshl+1} >>| tell freshl
the \CI{namedsds} class is exactly the same other than that it stores the given
name in the \CI{BCShare} structure as well.
the \CI{namedsds} class is exactly the same other than that it stores the given
name in the \CI{BCShare} structure as well.
caption={Bytecode view for \texttt{arith}}]
freshshare = get >>= \st=:{freshs}->put {st & freshs=freshs+1} >>| pure freshs
caption={Bytecode view for \texttt{arith}}]
freshshare = get >>= \st=:{freshs}->put {st & freshs=freshs+1} >>| pure freshs
\CI{BCSdsStore} or \CI{BCAnalogWrite} instruction respectively. The
implementation for this is given in Listing~\ref{lst:assignmentview}.
\CI{BCSdsStore} or \CI{BCAnalogWrite} instruction respectively. The
implementation for this is given in Listing~\ref{lst:assignmentview}.
caption={Bytecode view implementation for assignment.}]
instance assign ByteCode where
(=.) (BC v) (BC e) = BC (e >>| censor makeStore v)
caption={Bytecode view implementation for assignment.}]
instance assign ByteCode where
(=.) (BC v) (BC e) = BC (e >>| censor makeStore v)