Next Previous Contents

9. Module Header Syntax

The module header is the only bit of syntax "built in" to AMC (not done via CGL) for source modules. All modules must begin with a module header as their first syntactic element.

The module header always begins with the keyword module. The type keyword must always follow the module keyword. Although the type keyword may seem unecessary, it was made part of the syntax in the event that the module header be expanded in ways that can not be foreseen.

Following the type keyword is the actual type of module (as defined in the project file). The type keyword is the only mandatory component of the module header, all the rest are optional.

One optional clause is the uses clause. The uses keyword follows the type specifier and lists the modules that this module uses. For example:


  module 
    type c
    uses  (sqrt   in math,
           base   public,
           event  in oslayer public)
    ;

The module list in the uses clause must always be delimited with parenthesis. Each entry in the list is delimited by a comma. If the module is in another location the in keyword must be specified followed by the location where that module resides.

If the keyword public follows the module name and (optional) location specifier, any public definitions in that module are automatically exported in this module.

Circular dependencies are not allowed. AMC automatically detects this and informs you of the offending modules. AMC also detects the case of a module trying to use its own interface. By definition all modules automatically get their public interface locally. Naming the module as a dependant in the uses clause is flagged as an error.


Next Previous Contents