💾 Archived View for republic.circumlunar.space › users › dbane › gemlog › 2023-08-14.gmi captured on 2024-05-12 at 15:59:58. Gemini links have been rewritten to link to archived content

View Raw

More Information

⬅️ Previous capture (2023-09-08)

-=-=-=-=-=-=-

KL1 on a Mac M1

KL1 is a programming language from the 1980s Japanese 5th Generation project. It's a committed-choice logic programming language derived from Prolog, but (perhaps fatally) not particularly compatible with Prolog.

5th Generation project

Nevertheless, I find it very academically interesting. So I was pleased to see that it has been revived for modern systems. Especially, I thought it was limited to 32-bit machines but today I succeeded in getting it working on a 64-bit M1 Mac.

KLIC revival

The first step is to configure the release tarball:

1. You should start by copying config.sh.macOS-ARM64 below to config.sh

2. You'll need to slightly modify Configure with the below patch. On modern macOS, there is no simple C library to run "nm" against.

3. Then run ./Configure

4. Then you'll need to regenerate lock.s because the current version is for ARM7 (Raspberry Pi I assume). "cd runtime/config/shm/ARM; gcc -S spinlock.c; cp spinlock.s lock.s"

New config.sh template

Patch to apply to "Configure"

Some details on the macOS dyld shared cache

Now the sequence of "gmake all", "gmake tests", "gmake disttests" and "gmake install" should all succeed. And you can compile and run your own code too.

I think I still prefer Mercury, I like the option of running on Windows. But a bit like Emacs, it's impressive how KLIC's initial design made maintenance feasible over this timespan.

Back to my gemlog