Modula-2 (
ModulaTwo) is the 2nd of the
ModulaLanguages, thus one of the
WirthLanguages. It was a refinement of the original Modula (
ModulaOne), which was derived from Pascal (
PascalLanguage). Modula-2 is the ancestor of Modula-3 (
ModulaThree) and Oberon (
OberonLanguage). Wirth used it to develop the Lilith workstation in the late seventies. He was inspired during his 1976 sabbatical leave at
XeroxParc by Mesa (
MesaLanguage), which was also an extension of Pascal.
Main differences to Pascal
- Module concept for separate compilation of independent program units
- Name spaces, with qualified and unqualified identifiers, tied to modules
- Encapsulation with separation of interface and implementation, tied to modules
- Procedure types
- Unsigned integer type (CARDINAL)
- Explicit type conversion (safe) and type casting (unsafe) required
- I/O via modules instead of built-in language support
- Pseudo module SYSTEM for accessing system dependent resources
- Machine dependent types BYTE, WORD, ADDRESS
- Built-in coroutine support for concurrency: PROCESS, NEWPROCESS, TRANSFER, IOTRANSFER
Dialects of Modula-2
- PIM2, language report published in the 2nd edition of Wirth's "Programming in Modula-2"
- PIM3, minor revision of PIM2, published in the 3rd edition of Wirth's "Programming in Modula-2"
- PIM4, minor revision of PIM3, published in the 4th edition of Wirth's "Programming in Modula-2"
- ISO 10514-1, specification published by the International Standards Organisation (ISO)
- R10, language revision of 2010 based on PIM, authored by two former ISO WG participants
ISO 10514-1 clarified some ambiguities and added structured literals, a complex number type, exception handling, module finalisation and a standard library.
Supersets of Modula-2
- PIM supersets
- Modula-2+, developed at DigitalEquipmentCorporation, adding preemptive threads, garbage collections and exception handling
- Modula-2*, adding support for parallel computing
- Modula-P, another parallel extension
- Modula-Prolog, adding a Prolog layer
- Modula-2/R, adding support for relational databases
- Objective Modula-2 (ObjectiveModulaTwo), adding a Smalltalk derived OOP layer for native support of Cocoa and GNUstep
- ISO supersets
- ISO10514-2, adding an OOP layer
- ISO10514-3, adding a generics layer
- Mod51, adding an IEC1132 layer for embedded systems development
Derivatives of Modula-2
- Modula-3 (ModulaThree), developed by former Xerox PARC employees at DigitalEquipmentCorporation and Olivetti
- Oberon (OberonLanguage), developed by Niklaus Wirth for the Oberon operating system
- Oberon-2, revision of Oberon with support for object oriented programming
- Umbriel, a teaching language by Pat Terry
Modula-2 Books
- Niklaus Wirth 1982: Programming in Modula-2. Springer-Verlag: Berlin, ISBN 3-540-11674-5; New York, ISBN 0-387-11674-5.
- Gary Ford & Richard Wiener 1985: Modula-2: A Software Development Approach. John Wiley & Sons Inc. 416 pp. ISBN -0-471-87834-0.
Modula-2 Compilers
- Actively developed/maintained
- ACK Modula-2, part of the Minix operating system, open source
- Aglet Modula-2, for AmigaOS 4.0, PPC only, freeware
- GNU Modula-2, a GCC front-end, cross-platform, open source
- Mod51, targeting 80C51 micro-controllers, for embedded systems development, commercial
- Modula2JCC, a compiler written in Java, graduation project, open source
- Modulaware Modula-2, for OpenVMS, both Alpha and VAX, commercial
- Objective Modula-2, targeting C and LLVM, cross-platform, open source
- p1 Modula-2, for Macs, generates PPC assembly and C source, but Carbon only, commercial
- No longer maintained but still available
- Canterbury Modula-2, generates Java source, cross-platform, commercial
- Logitech/Multiscope Modula-2, for MS-DOS, commercial
- M2VMS by Terra, for OpenVMS, both Alpha and VAX, commercial
- MOCKA Modula-2, for Linux and 386BSD, freeware
- XDS Modula-2, for Linux and Windows, x86 or targeting C, freeware
- No longer available but of historic interest
- Stony Brook Modula-2 was available for MS-DOS and Windows
- TopSpeed Modula-2 was available for MS-DOS and Windows
- Volition Systems Modula-2 was available for many platforms, targeting the UCSD-p virtual machine, a predecessor of Java's JVM
Active Modula-2 Projects
Modula-2 Online Resources
Modula-2 IRC chat
- irc://irc.freenode.org/#modula-2
CategoryProgrammingLanguage CategoryPascal ModulaLanguage