VDM-10 Language Manual
VDM-10 Language Manual
VDM-10 Language Manual
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
Chapter 17. Top-level Specification (<strong>VDM</strong>-SL)<br />
17.2 A Structured Specification<br />
As an extension to the standard <strong>VDM</strong>-SL language, it is possible to structure an <strong>VDM</strong>-SL specification<br />
using modules. In this section, the use of modules to create the top-level specification will<br />
be described. With the structuring facilities offered by <strong>VDM</strong>-SL it is possible to:<br />
• Export constructs from a module.<br />
• Import constructs from a module.<br />
• Rename constructs upon import.<br />
• Define a state in a module.<br />
17.2.1 The Layout of a Module<br />
Before the actual facilities are described, the general layout of a module is described. A module<br />
consists of three parts: a module declaration, an interface section, and a definitions section. It is<br />
possible to leave out the definitions part in the early development of a module specification.<br />
In the module declaration, the module is named. The name must be a unique module name<br />
within the complete specification. The second part, the interface section, defines the relation of a<br />
module with other modules and consists of a number of sections. These sections are:<br />
• An imports section. In the imports section, all the constructs that are going to be used from<br />
other modules are described. If constructs are going to be renamed it has to be done in the<br />
imports section.<br />
• An exports section. Here all the constructs that are going to be used in other modules are<br />
defined. If no exports section is present the module cannot be used from other modules.<br />
The third part of a module declaration, the definitions section, contains all the definitions of the<br />
module. Thus, in general, the syntax of a module is:<br />
Syntax:<br />
module = ‘module’, identifier, interface,<br />
[ module body ], ‘end’, identifier ;<br />
module body = ‘definitions’, definition block, { definition block } ;<br />
To illustrate the use of modules, the example flat top-level specification are rewritten with some<br />
minor modifications. Some unimportant parts of the flat specification are left out for clarity.<br />
153