Web Prolog -- the second round

Hi all,

Almost seven years have passed since I first posted here about my ideas around Web Prolog – a profile of Prolog that features Erlang-style concurrent programming, which could potentially allow different Prolog implementations to talk to each other over the Web.

During the last five years, after retiring from my position at the University of Gothenburg, the project has grown into both a 350-page book draft and a fairly comprehensive online demonstrator, with links to GitHub repositories containing the relevant code.

For a long time I did not think I would be able to finish something worth showing to others, but thanks in part to LLMs – mostly Claude, but also ChatGPT – I now believe I have something reasonably presentable.

The project homepage is here:

I would be very grateful for any thoughts, comments, criticism, or suggestions you might have — especially from the perspective of SWI-Prolog, interoperability between Prolog systems, and the future of Prolog on the Web.

PS. The online demonstrator is still a little brittle, so please do not be surprised if it is temporarily down. I will try to keep it alive over the next few days.

Best regards,
Torbjörn

Hi Torbjörn, that is a pretty large and interesting undertaking! Just curious, would the Ciao Prolog web version (see, e.g., the Ciao Prolog Playground - Ciao Prolog Playground for an application) also serve as a node there?

Hi Manuel,

Yes, I think that would work, either as a browser runtime (which I don’t refer to as a node) or (maybe) as a node.js application?

Actually, this morning I instructed Claude to implement a simple node in Ciao Prolog, see Proofs-of-Concept.

Hi all,

I thought I should add a concrete update to my post from May, since the project has changed quite a lot since then.

The largest change concerns SWI-Prolog in the browser. The demonstrator now contains an actor-capable browser node. Each actor runs in its own Web Worker with an independent SWI-WASM instance and private Prolog context. It supports the same actor vocabulary as the native implementation – spawn, send, receive, links, monitors, and the higher-level behaviours – and can interact with native Web Prolog server nodes. It is of course different from a server node as it doesn’t accept inbound network connections.

Using a technique that Jan once showed me, the implementation has also been reorganised into independently loadable layers. These range from a stand-alone actor library, through actor isolation, toplevel actors, reusable behaviours, and distribution/RPC, up to the complete node server. The layers can be loaded separately – for example as library(web_prolog/actors), library(web_prolog/rpc), or the composed library(web_prolog) – and the test suite is divided into corresponding conformance tiers.

Other additions include a Discovery Hub and service-publication predicates, considerably more explicit protocol and deployment/security documentation, browser/native statechart conformance work, and state-scoped event deferral in SXML.

The book manuscript has grown to almost 450 pages. Among the main additions are a node-protocol reference, a substantially revised implementation appendix, and a benchmarking appendix comparing browser SWI-WASM actors, native SWI-Prolog actors, and Erlang processes.

As before, the project homepage is here: https://trinity.elfenbenstornet.se .

It would be interesting to know what people think about the demonstrator. Anything that I should improve? (The examples featuring an LLM and Jev are very recent additions, and yes, I know they do need a revision – and they only work in the node N3.)

Best regards,
Torbjörn