1.1 Positioning SWI-Prolog
Most implementations of the Prolog language are designed to serve a limited set of use cases. SWI-Prolog is no exception to this rule. SWI-Prolog positions itself primarily as a Prolog environment for‘programming in the large’and use cases where it plays a central role in an application, i.e., where it acts as‘glue’between components. At the same time, SWI-Prolog aims at providing a productive rapid prototyping environment. Its orientation towards programming in the large is backed up by scalability, compiler speed, program structuring (modules), support for multithreading to accommodate servers, Unicode and interfaces to a large number of document formats, protocols and programming languages. Prototyping is facilitated by good development tools, both for command line usage and for usage with graphical development tools. Demand loading of predicates from the library and a‘make’facility avoids the requirement for using declarations and reduces typing.
SWI-Prolog is traditionally strong in education because it is free and portable, but also because of its compatibility with textbooks and its easy-to-use environment.
Note that these positions do not imply that the system cannot be used with other scenarios. SWI-Prolog is used as an embedded language where it serves as a small rule subsystem in a large application. It is also used as a deductive database. In some cases, this is the right choice because SWI-Prolog has features that are required in the application, such as threading or Unicode support. In general though, for example: GNU-Prolog is more suited for embedding because it is small and can compile to native code; XSB is better for deductive databases because it provides a mature implementation of tabling including support for incremental updates and Well Founded Semantics1Sponsored by Kyndi and with help from the XSB developers Theresa Swift and David S. Warren, SWI-Prolog now supports many of the XSB features.; and ECLiPSe is better at constraint handling.
The syntax and set of built-in predicates is based on the ISO standard Hodgson, 1998. Most extensions follow the‘Edinburgh tradition’(DEC10 Prolog and C-Prolog) and Quintus Prolog Qui, 1997. The infrastructure for constraint programming is based on hProlog Demoen, 2002. Some libraries are copied from the YAP2http://www.dcc.fc.up.pt/\~{}vsc/Yap/ system. Together with YAP, we developed a portability framework (see section C). This framework has been filled for SICStus Prolog, YAP, IF/Prolog and Ciao. SWI-Prolog version 7 introduces various extensions to the Prolog language (see section 5). The string data type and its supporting set of built-in predicates is compatible with ECLiPSe.