Good news! I got the Modula-2 compile front-end in gcc to work!

% sudo port install gcc15
% cat hello.mod
MODULE hello;

FROM StrIO IMPORT WriteString, WriteLn;

BEGIN
WriteString('Hello Mod-2!');
WriteLn()
END hello.
% gm2-mp-15 -o hellomod2 hello.mod
% ./hellomod2
Hello Mod-2!

Yes, the compiler is "gm2-mp-15", had to do `port contents gcc15` to work that out.

Now I just need to relearn Mod-2, haven't touched it since the '80s.
#modula2 #retrocomputing

Unlike most old computing books, everything in Modula-2 on archive has been marked "borrow" or "no borrow available". Good thing there's another archive to get those from.

Wirth's own book should be a good starting point.

Modula-2 compile time & performance on linear stuff seems fine (anecdotal, I need to code a few proper benchmarks). Recursion eats a lot of memory & CPU, but it's tolerable.

There's no easy way to read/write longs except by IO. I had a screaming/stabbing rage fit for a bit, trying to figure out how IOChan & command-line arguments work, because of course there's no clear IO examples in the specs.

Similar test in Chez Scheme, got smoked a bit, I presume by moving to bignums.

FUN!
#modula2

Modula-2 is a lot less bitchy about semicolon placement than Pascal, & has implicit BEGIN everywhere, so it's actually kinda nice.

CAPSLOCK keywords, or exactly matching case of every function is required. @_@

When it does blow up, tho, like by using = instead of := assignment, I get 5-10 lines of nonsense errors saying the program's incomplete, & it gives up on finding any other errors. It might be as bad as a 1980s C compiler ever was, just comically awful at error reporting.
#modula2

Having amusing flashbacks to college graphics class, which Prof Chuck taught with Pascal & his own graphics lib, OR you could use Turbo Pascal, or C, or whatever. I did about half in Modula-2 on my ST, & the rest in C with INT $10 calls on my OS/2 machine.
#modula2

Old-timey (pre-80s) people had some peculiar ideas about gender roles.

#modula2

So all the super fun parts of archaic languages.

Strings are either ARRAY OF CHAR, which you allocate statically but then are invalid outside the function obvs. Or DynamicStrings "String", which you have to StringInit & KillString.

There's at least 3, maybe more, IO systems. Original (PIM) sucks, it can talk to one stream or file at a time. IOChan (kawaii!) is saner, but functions for each type are in 99 different modules.

Compile/link is so annoying. I may have to use make! UGH!
#modula2

The spec has graphics! LineDrawing, Mouse, all sorts of cool stuff!

Of course GCC doesn't include this, because then GNU would have to spend some effort on something besides sexism & whining about Nintendo.
#modula2

@mdhughes I think "GNU" in that case are probably a small bunch of students or enthusiasts working on a frontend, which is also why the hot new thing is a Algol-68 frontend (all the industry's money seems to get sunk into LLVM). Also, did any compiler ever implement those? There's a lot to Modula-2 that appears to only have ever worked on those weird home-built Swiss computers Wirth built.

Of course, the proper period-correct method would involve something like "GKS".

@mhd I'm pretty sure (haven't looked at the manuals in 25 years) those were the basic graphics functions in Hisoft's compilers, & then they had plat-specific modules as well.

Most 16-bit machines made graphics easy, of course, & modern OS's are a giant pain in the ass, but there are libraries you can link to make these things work.