You can divide your code into different modules. Many packages contain
a main module, usually named
Main.m3
.
The main module specifies the main body of your program. Here is an example
of a main program:
MODULE Hello EXPORTS Main; IMPORT IO; BEGIN IO.Put ("Hello World\n"); END Hello.
To use another module, you import
an interface exported by that module. In this example, we have imported
only the IO
interface to do simple
input/output. By looking at the IMPORT
clause, you can easily find out
what interfaces a piece of code depends on.
The last part of each module is its body. In this case, we are calling
the procedure IO.Put
which prints
the text string "Hello World"
to the standard output.