Chapter 2

The Environment of

Modula-3

A brief history of Modula-3

Modula-3 is a modern programming language hat supports interfaces, objects, generics, the isolation of unsafe code, garbage collection, exception handling and subtyping. Modula-3 was designed to be substantially simpler than other languages with comparable power, in order to facilitate the construction of large applications.

A Modula-3 environment for MS-DOS

This is a version of Modula-3 that is running on a plain DOS-PC. The main source is addressed to students of undergraduate programming courses and the other Modula-3 programmers that are beginners. The environment of Modula-3 was developed from the Department of Informatics, University of Klagenfurt. This is used as their introduction into the programming courses. The system implements version 2.09 of the Digital System Research Centers, Modula-3 implementation. This particular source uses the Daniel Lee Jackson's PC port of the Gnu C compiler. This is included in their release and can be formatted completely from here and from many other sites.

Features of this version

Our version features:

automatic compilation (to substitute the lack of m3build)
support for Unix-like long filenames
library to access DOS-files and directories.

They have built a little shell (m3shell) which will and can translates the long filenames they we may type in, into the DOS-filenames. This can be used instead of the graphical enviromnment. It has an unix-lookalike "ls"-command available in this program. There are many different commands that will be able to teach the system the new long filenames.

There is also another version that is based on an older version of djgpp which includes a graphical ide (but this is much more difficult to install, and it also has a memory leakages problems and it will not run under windows).

The Environment of Modula-3, using advanced programming

Modula-3 is the high-end successor of Modula-2. Besides having a clean and mature set of structured and object-oriented programming features, Modula-3 also is a supporting programming in a large and excellent way.

In the advanced programming of Modula-3, there are lots of features available. According to the version, the type, and the model of Modula-3 that you use, the environment is going to be much different. In this particular type the following features are available:

modules: multiple interfaces and implementations, generic modules;
concurrent and parallel programming: threads, mutex-objects, "network objects" (for type safe method calls between different address spaces);
persistence: interfaces for I/O communication, the "pickle" interface for automatic storing and loading of any dynamic data structures to/from secondary storage or the network;
graphics: a graphical environment available under Unix and Windows/NT.

Other Environment Factors of Modula-3

The Modula-3 community is supported by a massive collection in ftp://gatekeeper.dec.com/pub/DEC/Modula-3/. This archive contains boot code, example programs, and large amounts of mailing lists and news group discussions. Be sure that while you are learning this, you peruse the README file in the release directory before initiating any FTP's. Lest you grab large amounts of useless (on your machine) boot code.

Characteristics Describing the Environment

In this section you will be informed on what will and what will not be excepted while using the language of Modula-3. Modula-3 is a descendant of the Pascal family of languages. Therefore, it also has some characteristics which will be familiar to the C/C++programming languages. Keep in mind that ever version does not allow the same things to happen. So you have to go with the version that is being used to decide what features are available to you. This is just a few things and features that almost every version goes by.

Case is significant
All keywords and reserved words must be in uppercase letters. Identifiers such as variables, constants, and procedure names must always appear in the same case as the one used in the definition. For example, Main and main are two different identifiers.
Single main module
Every Modula-3 program must have one and only one main module. For small programs, the main module may be the only module.
Comments
Comments are of the form "(* comment *)" and may expand several lines.
BEGIN/END for code blocks
Code blocks are done by enclosing the code in a matched set of BEGIN/END. One important point to notice is that for a procedure the END must be followed by the name of the procedure.
Semi-colon separate statements
Each statement must be separated by a semi-colon.
Sources in ./src
All of the Modula-3 programs must be located in a subdirectory called src from the directory where the compiler will be called. The result program will be saved in a directory off the current directory and named the name of the operating sytem currently running.

Referernce

Laszlo, Böszörmenyi. Advanced Programming in Modula-3. University of Klagenfurt, Austria
Dubeau, Louis-Dominique. New Development Environment. September 4, 1997.
Schuab, Stephen. Modula-3 Reference and Tutorial. January 1997.

By: Oneta' Bunn