next up previous
Next: Deductive Knowledge Up: Milord II: Language Description Previous: Introduction

Modules

 

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.

   figure2299
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.

Hierarchy:
Is a set of module declarations. We say that these modules are submodules of the module that contains them.

Interface:
It has two components, the import and the export interface. They declare which facts could be asked to the usergif (import) and those that can be results of the module (export). All the facts inside a module not declared in the export interface are hidden to the outside of the module.

Deductive and Control:
These declarations allow modules to compute the components of its export interface (output) from the components of its import interface and those of the export interfaces of its submodules (input). Deductive knowledge includes the declarations of the object language which in our current implementation is mainly a rule-based language. Control knowledge is declared by means of a meta-language which acts by reflection over the deductive knowledge and the hierarchy of submodules. A module with an empty deductive and control components is considered to be a pure interface (a signature).

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.


next up previous
Next: Deductive Knowledge Up: Milord II: Language Description Previous: Introduction

Josep Puyol-Gruart
Thu Oct 23 15:34:13 MET DST 1997