SWI-Prolog

From Wikipedia, the free encyclopedia
Jump to: navigation, search
SWI-Prolog
New SWI-Prolog logo
PceEmacs - Emacs clone in SWI-Prolog
Original author(s) Jan Wielemaker
Developer(s) Jan Wielemaker, Anjo Anjewierden, etc
Initial release 1987
Stable release 6.2.6 / January 11, 2013; 14 months ago (2013-01-11)
Preview release 6.3.16 / June 9, 2013; 10 months ago (2013-06-09)
Development status Actual
Written in C, Prolog
Operating system Cross-platform
Available in English
Type Logic programming
License LGPL
Website swi-prolog.org/

SWI-Prolog is an open source implementation of the programming language Prolog, commonly used for teaching and semantic web applications. It has a rich set of features, libraries for constraint logic programming, multithreading, unit testing, GUI, interfacing to Java, ODBC and others, literate programming, a web server, SGML, RDF, RDFS, developer tools (including an IDE with a GUI debugger and GUI profiler), and extensive documentation.

SWI-Prolog runs on Unix, Windows, Macintosh and Linux platforms.

SWI-Prolog has been under continuous development since 1987. Its main author is Jan Wielemaker. The name SWI is derived from Sociaal-Wetenschappelijke Informatica ("Social Science Informatics"), the former name of the group at the University of Amsterdam, where Wielemaker is employed. The name of this group has changed to HCS (Human-Computer Studies).

User interface[edit]

SWI-Prolog is called by a command

swipl

Initially, it expects only queries, each ended by a period. An attempt to write a program will cause an error:

?- human(john).
ERROR: Undefined procedure: human/1

Here ?- is a system prompt. All the system output is shown in red color for illustration purposes.

Programs should be stored in a file and then read into the Prolog interpreter, by means of the query[1]

?-consult(file). 

which can be abbreviated

?-[file].

In order to type a program interactively, the following command should be used[1]

?-consult(user).

or

?-[user].

Then everything up to the next Ctrl-D is inserted into the database.

XPCE[edit]

XPCE is a platform independent GUI toolkit for SWI-Prolog, Lisp and other interactive and dynamically typed languages. Although XPCE was designed to be language-independent, it has gained popularity most with Prolog. The development XPCE graphic toolkit started in 1987, together with SWI-Prolog.

It supports buttons, menus, sliders, tabs and other basic GUI widgets. XPCE is available for all platforms supported by SWI-Prolog.

PceEmacs[edit]

PceEmacs is a SWI-Prolog builtin editor. PceEmacs is an Emacs clone implemented in Prolog (and XPCE). It supports proper indentation, syntax highlighting, full syntax checking by calling the SWI-Prolog parser, warning for singleton variables and finding predicate definitions based on the source-information from the Prolog database.

JPL[edit]

JPL is a bidirectional interface between Java and Prolog.[2] It requires both SWI-Prolog and Java SDK.[3] It is installed as a part of SWI-Prolog.[4]

See also[edit]

References[edit]

  1. ^ a b [1]
  2. ^ [2]
  3. ^ [3]
  4. ^ [4]

External links[edit]