swipl-devel: the SWI-Prolog source tree and its submodule trap
SWI-Prolog Main development repository
At a glance
- What is it?
- The SWI-Prolog main development repository holds a Prolog implementation written in C and Prolog, with a dozen API surfaces, a WASM build for the browser, XPCE as a native GUI toolkit, and a build that will not work unless you clone with submodules. The version line is 10.1.x, released every few days.
- Who is it for?
- Adopt this repository if you are building SWI-Prolog from source, hacking on the implementation, or packaging it, and you read C and Prolog. Do not clone it casually and expect a working tree, because the submodules are not optional.
- Can I use it commercially?
- Check first. The repository uses a licence we do not classify automatically, so read its LICENSE file before any commercial use.
- Is it still maintained?
- Yes. The repository received new commits within the last day.
- What is it written in?
- Mainly C, according to GitHub's language statistics.
Answers come from the project's GitHub data, last synced on October 23, 2026, and from our analysis. They are not legal advice.
Editorial analysis
A Prolog in C and Prolog, with extensions
SWI-Prolog is described as an open source, BSD-2 implementation of the Prolog language with many extensions. It is implemented in C, at version 11 of the language standard, and in Prolog itself, which is the arrangement that makes it extensible in a way a pure C implementation cannot be. The list of what it is used for is broad and worth reading as a statement of scope: business rule validation, natural language processing, software verification, software refactoring, network configuration, security, robotics, reasoning in legal and medical domains, graph processing, machine learning through inductive and probabilistic logic programming, linked data through RDF, and mathematical proofs. It is available for many platforms, Linux, practically any POSIX-like system, MacOS and Windows, and all CPUs supported by Debian Linux. The licence is BSD-2, with commercial assistance offered through SWI-Prolog Solutions b.v., and the up-to-date information lives at swi-prolog.org rather than in the repository.
The submodule trap, and the clone that works
The README devotes its first practical section to a problem that catches nearly everyone. This repository uses many Git submodules, which causes the common issue that fork and clone does not work. Instead, the instruction is to clone from the upstream repository and then associate your clone with your fork, replacing me with your GitHub user name:
git clone --recurse-submodules https://github.com/SWI-Prolog/swipl-devel.git
cd swipl-devel
git remote add myfork [email protected]:me/swipl-devel.gitThe reason for the rule is practical rather than ideological. A fork on GitHub does not carry the submodule pointers, so a fork plus a plain clone gives you a tree with empty dependency directories, and the failure appears later as a missing header or an unbuilt library rather than as an obvious error. The --recurse-submodules flag fixes it, and the separate remote means your patches go to your fork while the upstream history stays intact. If you are here to contribute a patch, the documentation also points to the page on how to submit a patch, and the forum thread on being friendly to quick contributions is the place to ask about the process.
Building it, and what lives in the tree
The build instructions live outside the README, in CMAKE.md and on the build page of the project site, which is the right place for them given the number of platforms. The tree shows what you are dealing with. There is src/ for the implementation, library/ for the Prolog libraries, packages/ for the optional bundled packages, boot/ for the boot image, cmake/ for the build definitions, plus app/, desktop/ for the XPCE front end, doc/ for the manual, man/ for the manual pages, demo/ with example programs, scripts/, tests/, a bench directory, and packaging directories including debian/ and customize/. There are also files that say something about how the project is run: VERSION holds the version, CMAKE.md and INSTALL.md describe the build, CODE_SIGNING.md covers signing the artefacts, and PRIVACY.md, SECURITY.md and a CODE_OF_CONDUCT.md handle the surrounding obligations. The demo directory is a nice touch for a new user, with colours.pl, likes.pl, trace.pl and unicode.pl as small programs to read before writing your own. A .clang-format and a .fileheader show the formatting and header conventions, and .gitmodules is the file that the clone instructions above exist to serve.
XPCE, PceEmacs and the editing story
The tooling is part of the reason to use this Prolog rather than another one. The comprehensive builds include XPCE, SWI-Prolog's native GUI toolkit, which provides the swipl-win executable that opens a Prolog terminal, along with PceEmacs, an Emacs clone with a rich Prolog mode, a source level debugger and profiling tools, and more. XPCE is included in the default binaries for Windows, MacOS and for Linux as a flatpak. For people who do not want the graphical environment, some editors come with a rich mode for Prolog, and GNU-Emacs provides sweep. The demo programs sit alongside this and show the same division of labour, since colours.pl and unicode.pl are about working with the language's term representation and trace.pl is about the tracer that PceEmacs also drives. The point of the combination is that a Prolog development is not just editing text, it is stepping through a backtracking search, and the tools here are built around that.
Two ways to run Prolog in a browser
There are two browser routes and they are not equivalent. The first is SWISH, an online version of SWI-Prolog, and the documentation is explicit about its limits: it is subject to sandbox restrictions and does not provide the features most valued in SWI-Prolog, such as its rich set of interfaces, multi-threading and modules. The second is SWI-Tinker, a WASM version, and the key difference is that it has no sandbox restrictions. Because it is Web Assembly, it can interact with the browser's DOM, which allows you to build interactive Prolog applications running inside the browser. The project also publishes a WASM NPM package called swipl-wasm for browser or Node projects, with a JavaScript API documented on the site. So the choice is between a shared online environment that is convenient and limited, and a build you can ship that is more capable, and for anyone building something in the browser the WASM route is the one that does not hit the wall.
Documentation you can query from the prompt
The manual is unusually well integrated with the running system, and the README gives the two queries that matter. The HTML version of the documentation is in the doc/Manual directory of the installation, with the caveat that some packagers put the documentation elsewhere or require it to be installed separately. The docs can be searched using ?- apropos("query")., and help on a predicate can be displayed using e.g. ?- help(append/3). A PDF version is available from the download page, and the website can be installed locally to use its complete functionality if you are offline, from the plweb repository. The forum and mailing list are hosted on a Discourse site that provides a mail list interface, so the older habit of reading a mailing list still works. The combination of a searchable manual, an in-prompt help function and a local copy of the site is what makes the difference between a Prolog that is pleasant to use and one that is merely correct.
Where SWI-Prolog is the wrong tool
Four limits are worth stating. The first is that Prolog is a commitment, not a library. A Prolog program is a set of relations and the way you decompose a problem into them is the design, so a team that arrives with an object-oriented decomposition will spend a lot of time reshaping the problem before the first clause is written. The second is that this repository is the development tree, not a release. It moves quickly, with 10.1.18 published on 2026-10-12, 10.1.17 on 2026-10-04 and 10.1.16 on 2026-09-25, and the tip of master is by definition unreleased. If you want a supported system, use the distribution packages rather than this tree. The third is the C and Prolog mix, which is what makes the system extensible and also what makes the build less portable than a pure Prolog implementation would be, since a compiler toolchain and the CMake configuration are part of getting it to run. The fourth is the browser story, where the sandboxed SWISH service is genuinely limited and the unrestricted WASM build is a build project rather than a website, so a team that wants Prolog in a browser is signing up for a toolchain.
Editorial conclusion
Adopt this repository if you are building SWI-Prolog from source, hacking on the implementation, or packaging it, and you read C and Prolog. Do not clone it casually and expect a working tree, because the submodules are not optional. Before you start, read CMAKE.md and INSTALL.md, run the clone with --recurse-submodules, and check the VERSION file against the release tag you actually need, since the tree moves quickly and the current line is 10.1.18 from 2026-10-12.
Frequently asked questions
Why does cloning the SWI-Prolog repository fail?
The repository uses many Git submodules, which causes the common issue that fork and clone does not work. The documented fix is to clone from the upstream repository with --recurse-submodules and then add your fork as a separate remote.
What language is SWI-Prolog implemented in?
In C, at version 11, and in Prolog itself, which is what allows the system to be extended with the same language it implements. It runs on Linux, practically any POSIX-like system, MacOS and Windows, and supports all CPUs supported by Debian Linux. The licence is BSD-2.
Can I run SWI-Prolog in a browser?
Yes, in two ways. SWISH is an online version subject to sandbox restrictions that does not provide the most valued features such as the rich set of interfaces, multi-threading and modules, while SWI-Tinker is a WASM version with no sandbox restrictions that can interact with the browser DOM, and there is also an NPM package called swipl-wasm.
How do I search the SWI-Prolog manual?
From the prompt with ?- apropos("query")., and help on a specific predicate with e.g. ?- help(append/3). The HTML manual is in the doc/Manual directory of the installation, a PDF version is on the download page, and the website can be installed locally from the plweb repository for offline use.
What GUI and debugging tools ship with SWI-Prolog?
Comprehensive builds include XPCE, the native GUI toolkit, which provides the swipl-win executable, along with PceEmacs, an Emacs clone with a rich Prolog mode, a source level debugger and profiling tools. XPCE is in the default binaries for Windows, MacOS and for Linux as a flatpak.
Official sources
Add this badge to your README
If you maintain this project, the badge below links readers to this analysis and shows its maintenance status from the daily GitHub snapshot. Paste the markdown into your README; add ?metric=license or ?metric=stars to the image URL for a different field.
[](https://hysenlabs.com/projects/swi-prolog-swipl-devel)Was this useful?