Discussion:
Installing Modula-2 on MacOS Big Sur
(too old to reply)
Deadmarshal
2021-09-22 06:52:11 UTC
Permalink
Hi, How can I install Modula-2 on Mac? Preferably, I want to install gnu modula-2 gm2 compiler but couldn't. It downloaded 800mb!
Nemo
2021-09-22 13:35:20 UTC
Permalink
Post by Deadmarshal
Hi, How can I install Modula-2 on Mac?
Are you are on Intel or M1?
Post by Deadmarshal
Preferably, I want to install gnu modula-2 gm2 compiler but couldn't. It downloaded 800mb!
Gm2 is built on gcc so downloading the former means downloading the
latter. Also, I recall that the default gm2 build is with full
debugging info, hence larger binaries.

N.
Deadmarshal
2021-09-22 13:47:31 UTC
Permalink
Post by Nemo
Post by Deadmarshal
Hi, How can I install Modula-2 on Mac?
Are you are on Intel or M1?
Post by Deadmarshal
Preferably, I want to install gnu modula-2 gm2 compiler but couldn't. It downloaded 800mb!
Gm2 is built on gcc so downloading the former means downloading the
latter. Also, I recall that the default gm2 build is with full
debugging info, hence larger binaries.
N.
I am on Intel. If Gm2 is not good, please give me the link of a good Mac compiler with install instructions to install it.
Deadmarshal
2021-09-24 12:05:23 UTC
Permalink
Post by Deadmarshal
Post by Nemo
Post by Deadmarshal
Hi, How can I install Modula-2 on Mac?
Are you are on Intel or M1?
Post by Deadmarshal
Preferably, I want to install gnu modula-2 gm2 compiler but couldn't. It downloaded 800mb!
Gm2 is built on gcc so downloading the former means downloading the
latter. Also, I recall that the default gm2 build is with full
debugging info, hence larger binaries.
N.
I am on Intel. If Gm2 is not good, please give me the link of a good Mac compiler with install instructions to install it.
Don't we have a Modula-2 compiler for Mac? Why nobody answers?
Martin Brown
2021-09-24 20:42:25 UTC
Permalink
Post by Deadmarshal
Post by Deadmarshal
Post by Nemo
Post by Deadmarshal
Hi, How can I install Modula-2 on Mac?
Are you are on Intel or M1?
Post by Deadmarshal
Preferably, I want to install gnu modula-2 gm2 compiler but couldn't. It downloaded 800mb!
Gm2 is built on gcc so downloading the former means downloading the
latter. Also, I recall that the default gm2 build is with full
debugging info, hence larger binaries.
N.
I am on Intel. If Gm2 is not good, please give me the link of a good Mac compiler with install instructions to install it.
Don't we have a Modula-2 compiler for Mac? Why nobody answers?
There were a couple of 68k Modula 2 compilers that worked OK on the old
Macs back in the day. I haven't kept track of which M2's would work on
the modern Intel based ones. Mocka might be a reasonable place to start.

https://github.com/trijezdci/MOCKA

The reason nobody answers is that there is hardly anyone left...

I still follow this group but I haven't done any serious development in
M2 now for more than two decades. The world has moved on!

XDS works pretty well on Intel and Windoze.
--
Regards,
Martin Brown
trijezdci
2023-05-03 07:43:35 UTC
Permalink
I haven't kept track of which M2's would work on the modern Intel based ones.
Mocka might be a reasonable place to start.
https://github.com/trijezdci/MOCKA
I'm afraid but MOCKA only generates elf binaries. On MacOS you need mach-o binaries though.

Now, there is still some mach-o support within the MOCKA sources as there might have been a version for NeXT back in the day and not all of it appears to have been removed in the open source version (which is only for Linux and BSD, all the others were commercial).

I had looked into that with a view to restoring mach-o support in the open source version you linked to. However, I can only work sporadically at these kinds of things and by the time I got back to it, the world had moved on to 64-bit only on desktop OSes. And since MOCKA's backend was generated by a commercial tool for which there are no sources available, this means that MOCKA is pretty much stuck in the 32-bit era. It would be a major effort to try to add 64-bit support to the generated backend code. And the only alternative would be to rip out the backend altogether and replace it with an entirely different one, either hand coded from scratch or a backend generated by an open source backend generator, like say MBurg. I have looked at the latter option as well, but concluded that I don't have the time for such an undertaking. So, I have basically written off MOCKA. I won't do any further maintenance on it, either.

But this also means that I lost my development platform for the bootstrap kernel of my own compiler, which I had initially started writing in C, then transcribed it to classic Modula-2 with some sources needing two versions, one for PIM and one for ISO even though I was mostly working on the PIM side using MOCKA. This made sense from a portability/deployment point of view but it required a lot more effort. So with MOCKA being stuck in the 32-bit era, I have now started to transcribe it all back to C.

https://github.com/m2sf/m2c

One of the major factors why I had put this on hold and transcribed the code to M2 was that the name translation scheme for translating Modula-2 identifiers into C identifiers while taking C's flat namespace into account was far too ambitious and complex, resulting in countless scenarios and a specification of about 20 pages for the name translation alone.

I have now fixed this by restricting the use of lowlines in M2 identifiers to non-leading, non-trailing and non-consecutive occurrences and ignoring any potential name collision cases that may arise from using any naming convention for the Modula-2 sources other than the prevailing camelCase and TitleCase convention. The name translation specification is now down to 1 page and a bit.

https://github.com/m2sf/m2c/wiki/Mapping-Modula-2-Identifiers-to-C

As this allows me to continue work without the sword of Damocles hanging over the development environment, I expect to be doing more work, less sporadically and possibly get the translator part working this year by leaving most of the semantic analysis for later.

But MOCKA is really dead now. Sure, it still works, but only on 32-bit Linux/BSD.

Translating to C won't have that kind of problem :-)

regards
benjamin
Brian Knoblauch
2021-09-24 22:07:18 UTC
Permalink
Post by Deadmarshal
Don't we have a Modula-2 compiler for Mac? Why nobody answers?
Unfortunately I don't even really know anyone that uses Mac these days. With OS X being BSD at the core though I'd expect some *nix based Modula-2 has a chance of being ported/working. Easiest option though might be to spin up a VM with Windows 10 or even *nix. Windows Modula-2 compilers are your best choice, but if you don't like Windows you should be able to get Modula-2 up and running on *nix.
Chris Burrows
2021-09-24 22:19:03 UTC
Permalink
Post by Deadmarshal
Post by Deadmarshal
I am on Intel. If Gm2 is not good, please give me the link of a good Mac compiler with install instructions to install it.
Don't we have a Modula-2 compiler for Mac? Why nobody answers?
I didn't answer because you didn't give sufficient information about:
a) why you wanted a Modula-2 compiler?
b) why you particularly wanted to install gnu modula-2?
c) why you had a problem installing gnu modula-2. Was it just the size that was a problem?
d) was there any particular feature of MacOS Big Sur that you need support for?
e) does it matter whether it is 32-bit or 64-bit?
f) were you looking for freeware or a commercially supported version?
etc. etc.

The more you tell us about your requirements, and which are 'must haves' or 'nice to have' the more we can help you with exactly what you want or maybe some alternative possibilities.

P1 Modula-2 is a commercial Modula-2 compiler for MacOS that is still actively maintained:

https://modula2.awiedemann.de/

If you want to investigate other Modula-2 compilers for other systems, here's a comprehensive list:

https://freepages.modula2.org/compi.html
trijezdci
2023-05-03 07:01:47 UTC
Permalink
Post by Deadmarshal
I am on Intel. If Gm2 is not good, please give me the link of a good Mac compiler with install instructions to install it.
Don't we have a Modula-2 compiler for Mac? Why nobody answers?
The only Modula-2 compiler dedicated to MacOS for modern Macs (Intel + ARM) is Albert Wiedemann's p1 compiler:

https://modula2.awiedemann.de/

It is a commercial product, but there is a free "demo" version which is limited to x86-64 and comes without library sources.

Otherwise, you need to look out for open source compilers that target x86 or generate C sources.

GM2 has been difficult to build and install on MacOS because it is based on gcc but had not been integrated into the main gcc branch yet. But this has now changed with GCC 13. So if you install GCC13 on your Mac, you will get GM2 automatically with it.

hth
benjamin
Nemo
2021-09-24 22:59:41 UTC
Permalink
Post by Deadmarshal
Post by Nemo
Post by Deadmarshal
Hi, How can I install Modula-2 on Mac?
Are you are on Intel or M1?
Post by Deadmarshal
Preferably, I want to install gnu modula-2 gm2 compiler but couldn't. It downloaded 800mb!
Gm2 is built on gcc so downloading the former means downloading the
latter. Also, I recall that the default gm2 build is with full
debugging info, hence larger binaries.
N.
I am on Intel. If Gm2 is not good, please give me the link of a good Mac compiler with install instructions to install it.
Unfortunately, I know of no good free MacOS compiler. (The p1 compiler
sells for 500 Euro.) You could try the Homebrew m2c but it requires a
bit of fiddling to install it.

N.
OrangeFish9737
2023-05-30 22:57:03 UTC
Permalink
Post by Deadmarshal
Post by Nemo
Post by Deadmarshal
Hi, How can I install Modula-2 on Mac?
Are you are on Intel or M1?
Post by Deadmarshal
Preferably, I want to install gnu modula-2 gm2 compiler but
couldn't. It downloaded 800mb!
Gm2 is built on gcc so downloading the former means downloading the
latter. Also, I recall that the default gm2 build is with full
debugging info, hence larger binaries.
N.
I am on Intel. If Gm2 is not good, please give me the link of a good
Mac compiler with install instructions to install it.
Unfortunately, I know of no good free MacOS compiler.  (The p1 compiler
sells for 500 Euro.)  You could try the Homebrew m2c but it requires a
bit of fiddling to install it.
N.
This is a bit but the latest GCC 13.1 now comes with gm2. Install it
(say via Homebrew) and you will have gm2.

O.F.

Loading...