The Translator (trl)

The Translator (trl) is invoked from the Translators Environment and is applicable to all implementations which are currently analysed, but not translated.

The C-compiler is set through the C Compiler/Flags setting of the Options; for example:

    gcc -g
would result in code produced by the gcc compiler with the debugging option set.

The setting of the Programming Language Option determines whether (currently) C or ANSI-C is produced as the intermediate language.

The Translator translates an IMPLEMENTATION into an executable code module; a prerequisite for translation is that the implementation and all subordinate implementations are analysed; the C Compiler is used to generate the executable binary for the machine on which the B-Toolkit is running. Subordinate implementations that are analysed but not yet translated are translated first.

If the specification `spec.mch' is implemented by `prog.imp', then translation of the latter will produce the files `spec.g',`spec.h', `spec.c' and `spec.o' all written to the CDE/C directory.`spec.o' is the binary linkable code module, `spec.h' contains header information for an IMPLEMENTATION which IMPORTS or SEES `spec.mch', and `spec.g' contains module parameterisation information to be used at link-time when the values of module parameters are known.

Note that, an IMPLEMENTATION has no variables of its own which are global to all operations (e.g. the VARIABLES clause is not allowed). All static data (information global to the module) or persistent data (information which survives from one invocation of the module to the next) must be held within other machines which the implementation IMPORTS. In the B-Toolkit environment there is a selection of such pre-defined machines.

The pre-defined machines are held in the System Library and can be introduced into a development by using the `Introduce construct from SLIB' facility.

The `main' Implementation:

The machine/implementation which contains the single operation `main' will be the main module of the development. This module will be the top node when all executable object modules are linked, and the main operation will be the entry when the linked code is invoked.

The Translation Process

The Translator translates the following clauses of an IMPLEMENTATION:

Note:


A full on-line help listing is available in the Contents Page
Also available in the form of a complete Index.
Blogo © B-Core (UK) Limited, Last updated: 22 Feb 2002