%\section{Implementation}
There are very many ways to get an implementation of
the \LBM\ as described above.
The language is intended not to take any further implication on the
implementation than those stated above
in section~\ref{abstract-model}.
Here we shall briefly provide some hints about
the current implementation in \TOPO,
most concretely the C implementation;
but it must not be regarded as an specification of the \LBM\ at all.

C is basically a single-task language.
Although there are means to create and manage several tasks,
it greatly relays on the O.S. facilities to create,
communicate, and manage these tasks.
For these reasons,
the current implementation is a single UNIX process.
This has permitted easy port to systems that don't support real
multiprocessing,
for instance to MS--DOS.

%Nevertheless,
%there are internally a number of {\em processes}
%under control of a local scheduler.
%Each BUT is mapped onto one of these ``processes''.
%To go further with similarities to conventional O.S. concepts,
%we distinguish between program and data segments,
%where program segments are pieces of reentrant code
%that may be shared by different instantiations.
%In terms of the \LBM,
%the stack S, and the environment F are local to each process,
%building up its data segment,
%that is private.
%The code C is the code segment,
%that is shared between similar processes in reentrant manner.
%Lastly,
%the Kernel Tree K is a centralized piece of information that is hold
%by the run time support.

Generated code is parameterized with respect to an instantiation frame
that holds state information,
both BUT entry and variable values.
This permits to use the C code as reentrant functions.
The kernel keeps as many frames as active BUTs,
and takes care of their allocation on BUT creation, and
removal upon termination.

%The main program holds a {\em process table} where program and data
%segment pairs define active instantiations.
%Furthermore,
%it holds information on synchronization requirements from each active
%BUT,
%classifying these ones into a number of queues:
%ready to run, waiting for \ldots.
%As synchronization conditions are met,
%the successful BUTs are scheduled as ready,
%and the failing ones are removed.
%All this centralized information is hold in the Kernel Tree.

Functionally,
the code is a collection of coroutines emulated in {\tt C}.
Pieces of code for the Kernel and the BUTs give control to each other
alternating their roles.
The status of each BUT instantiation is hold in its internal
variables.
%BUT code is purely reentrant,
%and the data segment is passed along with its call.
No assembler code is used anywhere,
nor any knowledge is assumed about target machine stack.
Coroutines are strictly implemented in conventional C code
to guarantee portability.

Being the Kt a centralized and shared facility,
its access must be severely restricted.
The visibility of the Kt from the BUTs is only via register K.
And K only points to a leave of the Kernel Tree.
BUTs do not look deeper into K,
but are only allowed to ``dress it'' with further structuring
information.
In practice,
K is a ``read only'' register that BUTs use to call run time support
libraries that do effective changes on the Kt.
Thus, only kernel code has write rights on the Kernel Tree.

\TOPO\ extends the language with annotations \cite{topo:l2c}.
These permit to perform external actions upon event occurrences,
as well as allow the environment to influence behaviour.
\LBM\ has a few more instructions to bridge these annotations from
\LOTOS\ onto the target language.
These extra instructions pass information unprocessed,
so that it is interpreted in the target language.
For instance,
it does not make a difference to write annotations in C or in Ada,
but the output of code generation is supposed to feed the appropriate
compiler.
These extra instructions have been not presented in this paper,
since they have no semantics relevance,
but interested readers may find the details in \cite{lbm}.

% Local Variables:
% mode: indented-text
% comment-column: 0
% comment-start: "% "
% comment-end: ""
% comment-start-skip: "% *"
