14 CHAPTER 1. INTRODUCTION
1.5 Implementation history
SWI-Prolog started back in 1986 with the requirement for a Prolog that could handle recursive inter-
action with the C-language: Prolog calling C and C calling Prolog recursively. In those days Prolog
systems were not very aware of their environment and we needed such a system to support interactive
applications. Since then, SWI-Prolog’s development has been guided by requests from the user com-
munity, especially focussing on (in arbitrary order) interaction with the environment, scalability, (I/O)
performance, standard compliance, teaching and the program development environment.
SWI-Prolog is based on a simple Prolog virtual machine called ZIP [Bowen et al., 1983,
Neumerkel, 1993] which defines only 7 instructions. Prolog can easily be compiled into this lan-
guage, and the abstract machine code is easily decompiled back into Prolog. As it is also possible
to wire a standard 4-port debugger in the virtual machine, there is no need for a distinction between
compiled and interpreted code. Besides simplifying the design of the Prolog system itself, this ap-
proach has advantages for program development: the compiler is simple and fast, the user does not
have to decide in advance whether debugging is required, and the system only runs slightly slower in
debug mode compared to normal execution. The price we have to pay is some performance degra-
dation (taking out the debugger from the VM interpreter improves performance by about 20%) and
somewhat additional memory usage to help the decompiler and debugger.
SWI-Prolog extends the minimal set of instructions described in [Bowen et al., 1983] to improve
performance. While extending this set, care has been taken to maintain the advantages of decompi-
lation and tracing of compiled code. The extensions include specialised instructions for unification,
predicate invocation, some frequently used built-in predicates, arithmetic, and control (;/2, |/2),
if-then (->/2) and negation-by-failure (\+/1).
1.6 Acknowledgements
Some small parts of the Prolog code of SWI-Prolog are modified versions of the corresponding Edin-
burgh C-Prolog code: grammar rule compilation and writef/2. Also some of the C-code originates
from C-Prolog: finding the path of the currently running executable and some of the code underlying
absolute
file name/2. Ideas on programming style and techniques originate from C-Prolog
and Richard O’Keefe’s thief editor. An important source of inspiration are the programming tech-
niques introduced by Anjo Anjewierden in PCE version 1 and 2.
Our special thanks go to those who had the fate of using the early versions of this system, sug-
gested extensions or reported bugs. Among them are Anjo Anjewierden, Huub Knops, Bob Wielinga,
Wouter Jansweijer, Luc Peerdeman, Eric Nombden, Frank van Harmelen, Bert Rengel.
Martin Jansche (jansche@novell1.gs.uni-heidelberg.de) has been so kind to reor-
ganise the sources for version 2.1.3 of this manual. Horst von Brand has been so kind to fix many
typos in the 2.7.14 manual. Thanks! Randy Sharp fixed many issues in the 6.0.x version of the manual.
Bart Demoen and Tom Schrijvers have helped me adding coroutining, constraints, global variables
and support for cyclic terms to the kernel. Tom Schrijvers has provided a first clp(fd) constraint solver,
the CHR compiler and some of the coroutining predicates. Markus Triska contributed the current
clp(fd) implementation.
Paul Singleton has integrated Fred Dushin’s Java-calls-Prolog side with his Prolog-calls-Java side
into the current bidirectional JPL interface package.
Richard O’Keefe is gratefully acknowledged for his efforts to educate beginners as well as valu-
able comments on proposed new developments.
SWI-Prolog 7.3 Reference Manual