Organizing Larger Projects


A Gentle specification is a list of declarations of types, predicates, and other items. In simple cases, a specification is written into a single file and submitted to the compiler.

If projects become larger and if more than one programmer is involved, it becomes desirable to split a specification into several files. Nevertheless, the compiler must still be able to check whether an application of an item (say, a predicate) matches the corresponding definition, even if that appears in a different file. Gentle supports this kind of separate compilation.

A specification may be decomposed into modules, where each module is written into its own file.

The content of a module is a list of declarations. Hence, the simple case can be understood as a one-module specification.

In addition to the list of declarations, a module may have a heading that lists the name of the module, other modules whose items are used here, as well as items declared here and made available to other modules.

Here is an example of a module heading:

   'module' CodeGen

      IR, TargetFile

This introduces a module name CodeGen. The module uses items that are declared in two other modules named IR and TargetFile. It declares an item (say a predicate) Encode that can be used by other modules.