Contents | Prev | Next | Index
A module is a collection of declarations of constants, types, variables, and procedures, together with a sequence of statements for the purpose of assigning initial values to the variables. A module is a compilation unit. The follwing syntax shows the Java specific extensions in red color. These Java extensions are implemented by this compiler as comment embedded directives which are only recognized at certain places.
compilation_unit ::= module
module ::= program program_id ;
package
import_list ::= import
block ::= decl_seq END |
The import list specifies the names of all the imported modules. If a module A is imported by a module M and A exports an identifier x, then x is refered to as A.x within M. If, however, A is imported as B := A, the item x must be referenced as B.x. This is mainly for using short alias names in qualified identifiers. Identifiers that are to be exported, that is, that are visible to client modules, must be marked by an export mark in their declaration.
This compiler maps an Oberon-2 module to a Java class. Its variables and procedures become static members of that class. An optional JAVA PACKAGE directive informs the compiler into what subdirectory to place the resulting Java files. The default is that the compiler output goes into the current working directory.
The statement sequence following the BEGIN keyword is executed when the module is loaded. Cyclic imports of modules are illegal.
Contents | Prev | Next | Index
Canterbury Oberon-2 for JVM (Last documentation update
Jun 2, 2000)
Copyright © 1998 Mill Hill &
Canterbury Corporation, Ltd. All rights reserved
Please send any comments or corrections to
mhc@webcom.com