The most primitive structural construct of Milord II is the module. A program (see Figure 1) is composed by a set of module declarations that can recursively contain other module declarations, then forming a hierarchy. Module declarations are surrounded by the keywords begin end. Between these two keywords all the components of the module, including submodules, must be declared; nothing belonging to a module can be declared outside these two keywords. Module declarations can be given a name, that becomes its identifier, see amodid in moddecl. The scope of these identifiers is the module declaration text -including the submodule declarations textually declared inside the module. Then, to refer to a submodule component (fact, rules, ...) we must prefix the identifier of the component by a path of the module identifiers of modules placed syntactically between the point of reference and the point of definition (pathid). Components in a path are separated by ``/''. Top level modules are then not prefixed.
Figure 1: Syntax of module definition.
Local names can be given to previously defined modules by allowing a reference to their name in the right part of a module name binding, see pathid in bodyexpr.
The contents of a module declaration can be clustered in the next sets of declarations: hierarchy, interface, deductive knowledge and control knowledge. The use of empty module declarations (notice that bodyexpr is optional) will be explained in Section 7.
In the subsequent sections we will describe in detail the different components that can be included inside a module definition. We will end up with a detailed description of the modular system of Milord II.