Copyright © 1996, 1997 Lucent Technologies Inc. All rights reserved.

5 Limbo programs

Limbo source programs that implement modules are stored in files, conventionally named with the suffix .b. Each such file begins with a single implement directive naming the type of the module being implemented, followed by a sequence of declarations. Other files, conventionally named with the suffix .m, contain declarations for things obtainable from other modules. These files are incorporated by an include declaration in the implementation modules that need them. At the top level, a program consists of a sequence of declarations. The syntax is


program: implement identifier ; top-declaration-sequence top-declaration-sequence: top-declaration top-declaration-sequence top-declaration top-declaration: declaration identifier-list := expression ; identifier-list = expression ; ( identifier-list ) := expression ; module-declaration function-definition adt-declaration
The implement declaration at the start identifies the type of the module that is being implemented. The rest of the program consists of a sequence of various kinds of declarations and definitions that announce the names of data objects, types, and functions, and also create and initialize them. It must include a module declaration for the module being implemented and the objects it announces, and may also include declarations for the functions, data objects, types, and constants used privately within the module as well as declarations for modules used by it.

Declarations are used both at the top level (outside of functions) and also inside functions and module declarations. Some styles of declaration are allowed only in certain of these places, but all will be discussed together.

05/Jun/97