(redirected from Modula 2)


[′mäj·ə·lə ′tü]
(computer science)
A general-purpose programming language that allows a computer program to be written as separate modules which can be compiled separately but can share a common code.


A high-level programming language designed by Niklaus Wirth at ETH in 1978. It is a derivative of Pascal with well-defined interfaces between modules, and facilities for parallel computation. Modula-2 was developed as the system language for the Lilith workstation.

The central concept is the module which may be used to encapsulate a set of related subprograms and data structures, and restrict their visibility from other portions of the program. Each module has a definition part giving the interface, and an implementation part.

The language provides limited single-processor concurrency (monitors, coroutines and explicit transfer of control) and hardware access (absolute addresses and interrupts). It uses name equivalence.

DEC FTP archive.

["Programming in Modula-2", N. Wirth, Springer 1985].


(MODUlar LAnguage-2) An enhanced version of Pascal introduced in 1979 by Swiss professor Nicklaus Wirth, creator of Pascal. It supports separate compilation of modules, allowing it to be used for large projects. The following example changes Fahrenheit to Celsius:

      module FahrToCent;
   from InOut import ReadReal,WriteReal,
   var Fahr:real;
   WriteString("Enter Fahrenheit ");
   WriteString("Celsius is ");
   WriteReal((Fahr - 32) * 5 / 9);
      end  FahrToCent
References in periodicals archive ?
The extension to Turing Pus is also discussed, and then compared with Ada and Modula 2.
We begin by briefly discussing the structure of Turing, contrasting its features with those of other languages like Pascal and Modula 2 and then giving examples of these features.
The inal example illustrates the module construct, which is available in languages like Modula 2 and Ada, but is missing from standard Pascal.
Turing Plus can be thought of as an alternative to C, Modula 2, and Ada.
The natural number or nat type, called cardinal in Modula 2 and unsigned in C, is introduced to represent nonnegative integers.
Turing Plus's processes are "true processes," meaning that they physically run in parallel if multiple CPU's are available and that CPU slicing is used to simulate this parallelism on a single CPU system, in contrast with the co-routines or pseudo processes of Modula 2, which never implicitly give up control and which are not immediately suitable for multi-CPU configurations.
Modula 2 and Ada are often mentioned as possible successors to Pascal.
Modula 2 is a relatively new languages that is attracting an increasing number of users.
Modula 2 improves Pascal's syntax by, for example, introducing end as a closing for if statements, but its syntax is wordy compared to Turing's.
Ada can be thought of as an overblown version of Modula 2.