Working in MODULA-2

I’ve been working in Modula-2 for last few weeks. It’s a considered a dead language now, one of Pascal’s descendants designed by Niclaus Wirth. I’ve been doing some updates to quite an old project, embedded system for military usage.  I had to run Mac OS 7.5 emulator to get original 1989 compiler running. Modula-2 dialect understood by this compiler is quite strict – you cannot even mix cardinal and integer numbers without explicitly converting one of them.

First difference you may notice (compared to Pascal) is case sensitiveness of Modula-2, for instance all reserved words are upper cased. You don’t have to write so many begin-end statements though. Another C-like trait is importance of header files (definition modules) order during compiling – just change it a little bit in a large project and whole thing breaks down.

More info about Modula-2 if you’re interested:


16 thoughts on “Working in MODULA-2

  1. The GNU Modula-2 compiler is still alive (and under active development #6-).

    I am curious about the 1989 compiler, though. What was the compiler? Was it a cross-compiler?


    • It is MCDS 2.6 environment. There’s a compiler, assembler, linker, PROM burner, etc. Supported target CPUs are MC68xxx, Intel 80xx, and some others used in embedded systems.

  2. Modula-2 may not be as widely used as it was in the 1980s but it’s not a dead language, especially not in embedded development. Mod51, for example is a Modula-2 compiler for the 8051 which is very popular and widely used.

    Outside of embedded development, the main reason why Modula-2 is not that widely used has been the long time absence of any open source compilers. In this day and age, no language can survive without an open source compiler available on mainstream platforms.

    The Modula-2 compiler vendors have been so unbelievably greedy that they killed their own market in the process, some have eventually released their compilers free of charge, but that was too little too late. The MOCKA compiler was briefly available under GPL but has been taken closed source again. What a bunch of losers who couldn’t set their code free!

    If there had been an open source Modula-2 compiler early on, the language would at least be as widely used as Free Pascal or D.

    However, there is now a working GCC front end for Modula-2, called GNU Modula-2. It supports the PIM standards and ISO support is being actively worked on. It isn’t part of the main GCC distribution yet, but when it will eventually ship with GCC, it will certainly increase the user base again.

    There is also another open source Modula-2 compiler project called Objective Modula-2 which adds extensions for GNUstep/Cocoa. It is to Modula-2 as Objective-C is to C. The compiler is still under development, but again, when there is a working distribution, this will also contribute to increase the user base, especially since it will also allow developing in Modula-2 for the iPhone.

  3. Your may be interested in the Oberon language. Another Niclaus Wirth creation. It seems to have a back to basics philosophy but according to wikipedia the 2007 version has got rid of the loop statement which seems a bit extreme.

    • I’ve heard about Oberon but never checked it out before. Syntax looks very much like that of Modula-2 at first glance, but it’s EBNF grammar is much shorter. I looked at Oberon-07 report to see how it can work without loops, but it looks like only a statement called LOOP was removed – FOR, WHILE, and REPEAT are still there.

  4. Hi, you might be interested in the IRC channel dedicated to discussing Modula-2 and Oberon. It is on the Freenode network (, channel #modula-2.

  5. if you want to stay -for good reasons- to a language that is Wirth’s sytle – I suggest to use Ada. There is a free compiler already well integrated into the gcc system. It works very well and is much more powerful than Pascal/M-2/Oberon. I had my own nightmare with several Pascal/M-2/M-3/ and Oberon compilers in the early 90’ies (the best one was Metaware’s Professional Pascal 2.8/i386-full 32 bit these days and definition/implementation files seprate). Ada comes with an inernational standartd and is very portable and clear. Most people I know from the M-2 days arrived at Ada. Critical software is written in Ada!

  6. We used to use TopSpeed Modula-2 which was excellent, but they never supported Windows so we had to depart to Delphi. I can still remember the happy days of porting around 200,000 lines of code. We did this using a translator that we wrote ourselves and for many months we were able to build our product in both Modula-2 and Delphi from a sources!

    • May I ask what kind of application was that? How was the GUI done that it could be build from both Modula and Delphi?


    ADW Modula-2

    ADW Modula-2, © ADW Software is the successor of Stony Brook Modula-2, and is released as freeware.

    ADW Modula-2 is for Windows only
    ADW Modula-2 allows development of both 32- and 64-bits programs on the Windows platform.

  8. IEC61311-3 ST seems to be the only Modula-2 relic active in large scale use today. Codesys produces a commercial PLC compiler. This should be leveraged.

    The new IOT environment requires safe and lean compilers for the lightweight battery environments. Modula-2 is ready fo this.

Leave a Reply

Your email address will not be published. Required fields are marked *