## 1.1 SWI-Prolog

SWI-Prolog started back in 1986 with the requirement for a Prolog that could handle recursive interaction with the C-language: Prolog calling C and C calling Prolog recursively. Those days Prolog systems were very aware of its 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 community, 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 very simple Prolog virtual machine called ZIP Bowen et al., 1983, Neumerkel, 1993 which defines only 7 instructions. Prolog can easily be compiled into this language 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 approach 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 when in debug mode. The price we have to pay is some performance degradation (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 decompilation 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.1.1 Books about Prolog

This manual does not describe the full syntax and semantics of Prolog, nor how one should write a program in Prolog. These subjects have been described extensively in the literature. See Bratko, 1986, Sterling & Shapiro, 1986, and Clocksin & Melish, 1987. For more advanced Prolog material see O'Keefe, 1990. Syntax and standard operator declarations confirm to the `Edinburgh standard'. Most built in predicates are compatible with those described in Clocksin & Melish, 1987. SWI-Prolog also offers a number of primitive predicates compatible with Quintus Prolog1Quintus is a trademark of Quintus Computer Systems Inc., USA Qui, 1997 and BIM_Prolog2BIM is a trademark of BIM sa/nv., Belgium BIM, 1989.

ISO compliant predicates are based on ``Prolog: The Standard'', Deransart et al., 1996, validated using Hodgson, 1998.