W Wrapl, The Programming Language

Modules

Introduction

Wrapl programs are designed to be loaded and run by the Riva module loader. Each Wrapl source file equates to a Riva module.

Each module has the form:
1MOD Name; 2 3{declarations and expressions} 4 5END Name.

where each declaration is a DEF declaration, a VAR declaration or an IMP declaration. Each expression should be terminated with a semicolon ;.

Imports

Constants and variables exported from one module can only be used in another module by importing them using an IMP declaration.

The declaration IMP Dir1.Dir2....File; defines File as a constant reference to a module with path Dir1/Dir2/.../File. An identifier Ident exported from File can be referenced in the current module as File.Ident. A different identifier can be used to hold the module reference using an AS clause: IMP Dir1.Dir2....File AS Name;. Each part of the path Diri or File is either an identifier or a string. If File is a string, then an AS clause is necessary to provide a valid identifier to hold the module reference.

A declaration of the form IMP Dir1.Dir2....File USE Ident1, ...,Identk; is equivalent to the sequence of declarations IMP Dir1.Dir2....File; DEF Ident1 <- File.Ident1;...DEF Identn <- File.Identn;.