Modula-2 Compilers on CP/M

In retrocomputing, we’re more often than not turning our eyes towards the low level side of programming. But there are also some high level languages of interest, like Niklaus Wirth’s Modula-2, which may represent the apex of Algol-like languages and is also pretty fast. Also, it’s by Niklaus Wirth!
(Personally, I never did any Modula-2 programming myself, but I learned building compilers by Modula-2 examples from Wirth’s books.)
Reason enough to have a closer look at the compilers that are available on C/PM, like Lawrence Woodman does it in this article.

Modula-2 is a great language in general and is a good choice for programming on CP/M. There are three good compilers available for CP/M which all require a Z80 processor and we’ll compare each in turn.

Modula-2

Modula-2 was developed by Niklaus Wirth and is based on his earlier language, Pascal. It introduces modules to allow separate compilation of related code and data structures which are encapsulated to provide tight control of scope. Modula-2 supports coroutines which make single processor concurrency relatively simple and provides easy access to low-level hardware.

HN discussion: https://news.ycombinator.com/item?id=32821990

1 Like

So how many languges has Wirth written NOW? It seems many langauges never seemed
to get past 16 bit code and data. Was this a because the X86 too hard to write larger code
under DOS? Was the langauge design, only good for 16 bit code and data?

Modula-2 was somewhat trapped between Pascal, which was fairly popular in education, and Oberon, which is still around. Much of the success of a languages is also due to luck.
E.g., Modula-2 may have well become the favorite language on ARM systems: Acorn had been developing a POSIX-like multiprocessing system, ARX, in Modula-2 at ARC (Acorn Research Centre, neighbor to Xerox PARC, where Wirth used to be around in the 1980s). Had the development of this gone a bit more straight forward and Acorn had chosen this as the OS for the Archimedes, things may have worked out differently and we may be all well aware of Modula-2. (Moreover, a serious Modula-2 based OS may have provided ARM just the push it needed to make itself known in the business market. And, maybe, the x86 community would have had to follow up on this. I can also imagine Apple to switch from Pascal to Modula-2 in a scenario like this, since you don’t want to be seen trapped in an outdated language.) However, as things were, Acorn went with the more modest ARTHUR project for RISC OS.

Edit: This was actually “Modula2+”:

“This ARX operating system was preemptively multitasking, multi-threaded, multi-user, written in Acorn-extended Modula2+.”

(How RISC OS happened, as told by original Acorn Arthur lead • The Register)

1 Like

The ARX guys in the US did use what you call Modula2+ though I think they called it ModulaIII, however Acorn in Cambridge used exclusively regular ModulaII on both the Vax and the 32016. I’m actually in the process of tracking down the sources of the compiler from one of the original authors at Cambridge who thinks there may be a copy preserved somewhere. I’ll post if it turns up. We do have the library and some binaries for the 32016 rescued already.

2 Likes

Great to hear that more sources or binaries might turn up from back in the day!

Ah, thanks, there is also Wikipedia page on Modula-3:

Here’s a report by DEC System Research Center (SRC), the original vendor (signed by Robert Taylor):
https://www.hpl.hp.com/techreports/Compaq-DEC/SRC-RR-52.pdf

And a playful depiction of what was new in Modula-3 (from this report – apparently someone was in love with their maze algorithm :slight_smile: ), most notably exceptions and multiple inheritance:

I still have my Modula 3 book signed by the author Greg Nelson. If I remember they had a “compiler” which generated C source code. I might still have a copy from the DEC Research Centre. Will look through my disks to see if I still have it, when I get back from this caravan trip tomorrow.

2 Likes

Do you remember how Modula-3 was perceived at the time?
Over the course of this thread, I’ve learned that Modula-3 is quite a different beast than Modula-2 and may have been well one of those rare languages which, while not well known on its own, may have defined the future of high-level programming languages (like Simula67). The feature list is quite impressive and is also, where everybody rushed to in the next decade. Or was this more what was already around and Modula-3 happened to pick this up early, but to not great consequence?