Modula-2

From Academic Kids

Modula-2 is a computer programming language invented by Niklaus Wirth at ETH around 1978, as a successor to Modula, another language by him that was never implemented. The Modula-2 language is loosely based upon the Mesa programming language, from Xerox, that Wirth saw during his 1976 sabbatical year at Xerox PARC.

Contents

Description

Modula-2 is a general purpose procedural language, sufficiently flexible to do systems work, but with much broader application. In particular, it was designed to support separate compilation and data abstraction in a straightforward way. Much of the syntax is based on Wirth's earlier and better-known language, Pascal. Modula-2 was designed to be broadly similar to Pascal, with some elements removed and the important addition of the module concept, and direct language support for multiprogramming.

The Modula-2 module may be used to encapsulate a set of related subprograms and data structures, and restrict their visibility from other portions of the program. The module design implemented the data abstraction feature of Modula-2 in a very clean way. Modula-2 programs are composed of modules, each of which is made up of two parts: a definition module, the interface portion, which contains only those parts of the subsystem that are exported (visible to other modules), and an implementation module, which contains the working code that is internal to the module.

The language has strict scope control. Thus, supposing ModuleA exports identifiers A, B and C, and suppose ModuleB contains the declaration

   IMPORT ModuleA;

Then this means that references to the exported identifiers must still be explicitly qualified by the exporting module name, thus: "ModuleA.A", "ModuleA.B", "ModuleA.C". The only way to avoid this qualification is to individually import the identifiers as follows:

   FROM ModuleA IMPORT
       A, B, C;

This may seem unnecessarily restrictive and verbose. But in fact it has the pleasant side-effect of providing automatic cross-referencing of the definition of every identifier in a program: if the identifier is qualified by a module name, then the definition comes from that module. Otherwise if it occurs unqualified, simply search backwards, and you will either encounter a declaration of that identifier, or its occurrence in an IMPORT statement which names the module it comes from. This property becomes very useful when trying to understand large programs containing many modules.

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

Related languages

Although Modula-2 is by far the best-known and most widely used variant, there are several languages which are related in one way or another: the original, and quite different, Modula (intended for systems implementation), Modula-2+, Modula-2*, Modula-3 (by DEC and Olivetti; adding garbage collection), Oberon (another, later, Wirth design), Oberon-2, and a number of others. These should not be regarded as "better versions" or "replacements" for Modula-2; most are different languages with different purposes, and with strengths and weaknesses of their own.

Along with C and Ada, Modula-2 is often regarded as one of the three most significant "modern" programming languages (ie, of the structured programming era). Of the three, Modula-2 is the smallest, easiest to read, easiest to learn, and cleanest designed, both syntactically and conceptually. Modula-2 was developed as the system language for the Lilith workstation, and formed the basis of the Oberon project at ETHZ. Most current programming languages have adopted many of the features of Modula-2.

A few popular compilers

  • TopSpeed (aka Clarion, aka JPI, aka Jensen and Partners) had several good 16-bit Modula-2 compilers, with nice productive IDE's. However to my knowledge they are not available anymore. For a while they came with the Clarion product though. This was the "Turbo Pascal" of Modula-2. Slightly non standard, but very popular both in business and education, an excellent toolchain.
  • Stony Brook Modula-2 (http://www.modula2.org/sb/websitearchive/indexw.html).
  • There is an effort to create a GNU Modula2 compiler (http://floppsie.comp.glam.ac.uk/Glamorgan/gaius/web/GNUModula2.html)
  • Logitech had a series of Modula-2 compilers.
  • Excelsior Modula-2 (xds) (http://www.excelsior-usa.com/xdsx86.html)

External links

This article was originally based on material from the Free On-line Dictionary of Computing, which is licensed under the GFDL.
de:Modula-2

es:Modula-2 it:Modula-2 nl:Programmeertaal Modula-2 ja:Modula-2 ru:Модула-2 sv:Modula-2

Navigation

Academic Kids Menu

  • Art and Cultures
    • Art (http://www.academickids.com/encyclopedia/index.php/Art)
    • Architecture (http://www.academickids.com/encyclopedia/index.php/Architecture)
    • Cultures (http://www.academickids.com/encyclopedia/index.php/Cultures)
    • Music (http://www.academickids.com/encyclopedia/index.php/Music)
    • Musical Instruments (http://academickids.com/encyclopedia/index.php/List_of_musical_instruments)
  • Biographies (http://www.academickids.com/encyclopedia/index.php/Biographies)
  • Clipart (http://www.academickids.com/encyclopedia/index.php/Clipart)
  • Geography (http://www.academickids.com/encyclopedia/index.php/Geography)
    • Countries of the World (http://www.academickids.com/encyclopedia/index.php/Countries)
    • Maps (http://www.academickids.com/encyclopedia/index.php/Maps)
    • Flags (http://www.academickids.com/encyclopedia/index.php/Flags)
    • Continents (http://www.academickids.com/encyclopedia/index.php/Continents)
  • History (http://www.academickids.com/encyclopedia/index.php/History)
    • Ancient Civilizations (http://www.academickids.com/encyclopedia/index.php/Ancient_Civilizations)
    • Industrial Revolution (http://www.academickids.com/encyclopedia/index.php/Industrial_Revolution)
    • Middle Ages (http://www.academickids.com/encyclopedia/index.php/Middle_Ages)
    • Prehistory (http://www.academickids.com/encyclopedia/index.php/Prehistory)
    • Renaissance (http://www.academickids.com/encyclopedia/index.php/Renaissance)
    • Timelines (http://www.academickids.com/encyclopedia/index.php/Timelines)
    • United States (http://www.academickids.com/encyclopedia/index.php/United_States)
    • Wars (http://www.academickids.com/encyclopedia/index.php/Wars)
    • World History (http://www.academickids.com/encyclopedia/index.php/History_of_the_world)
  • Human Body (http://www.academickids.com/encyclopedia/index.php/Human_Body)
  • Mathematics (http://www.academickids.com/encyclopedia/index.php/Mathematics)
  • Reference (http://www.academickids.com/encyclopedia/index.php/Reference)
  • Science (http://www.academickids.com/encyclopedia/index.php/Science)
    • Animals (http://www.academickids.com/encyclopedia/index.php/Animals)
    • Aviation (http://www.academickids.com/encyclopedia/index.php/Aviation)
    • Dinosaurs (http://www.academickids.com/encyclopedia/index.php/Dinosaurs)
    • Earth (http://www.academickids.com/encyclopedia/index.php/Earth)
    • Inventions (http://www.academickids.com/encyclopedia/index.php/Inventions)
    • Physical Science (http://www.academickids.com/encyclopedia/index.php/Physical_Science)
    • Plants (http://www.academickids.com/encyclopedia/index.php/Plants)
    • Scientists (http://www.academickids.com/encyclopedia/index.php/Scientists)
  • Social Studies (http://www.academickids.com/encyclopedia/index.php/Social_Studies)
    • Anthropology (http://www.academickids.com/encyclopedia/index.php/Anthropology)
    • Economics (http://www.academickids.com/encyclopedia/index.php/Economics)
    • Government (http://www.academickids.com/encyclopedia/index.php/Government)
    • Religion (http://www.academickids.com/encyclopedia/index.php/Religion)
    • Holidays (http://www.academickids.com/encyclopedia/index.php/Holidays)
  • Space and Astronomy
    • Solar System (http://www.academickids.com/encyclopedia/index.php/Solar_System)
    • Planets (http://www.academickids.com/encyclopedia/index.php/Planets)
  • Sports (http://www.academickids.com/encyclopedia/index.php/Sports)
  • Timelines (http://www.academickids.com/encyclopedia/index.php/Timelines)
  • Weather (http://www.academickids.com/encyclopedia/index.php/Weather)
  • US States (http://www.academickids.com/encyclopedia/index.php/US_States)

Information

  • Home Page (http://academickids.com/encyclopedia/index.php)
  • Contact Us (http://www.academickids.com/encyclopedia/index.php/Contactus)

  • Clip Art (http://classroomclipart.com)
Toolbox
Personal tools