Hessischer Bildungsserver / Arbeitsplattformen

SWI-Prolog-Editor [English-Version]

With the SWI-Prolog-Editor (Version 5.07 from 2020.10.31) a Windows-programming-environment for the work with SWI-Prolog which is suitable for schools has become available. The current version of the SWI-Prolog-Editor is tested for in lessons. In the documentation you find the most important information for work with the SWI-Prolog-Editor.


By means of language files the SWI-Prolog-Editor can be used with different languages. At present are available:

Bulgarian (by Mikhail Balabanov, update from 2008.06.27)

Chinese simplified (by Lin Jian)

Chinese traditional (by Yu Kwokyeung, 2007.11.13)

English (by Gerhard Röhner)

Español (by José O. Vázquez)

Galician (by Avelino Souto, 2008.05.30)

German (by Gerhard Röhner)

Greek (by George Kalpakas, 2008.08.23)

Hungarian (by DirektX, 2010.09.13)

Italian (by Marco Falda, 2009.14.12)

Portuguese (by Jorge W.D. Leão)

Quebec-French (by Simon-Pierre Morin, 2009.10.29)

Romanian (by Marius Filip)

Russian (by Janvarev Vladislav)

Turkish (by Edip Serdar Güner, Update from 2010.11.07)

To offer a language file in your language, just take the english language file, translate it and sent it to me.

Installation of SWI-Prolog

Before the installation of SWI-Prolog-Editor you should install SWI-Prolog. You find the necessary programs and help-files on the SWI-Prolog Site. You can use a 32-bit version or 64-bit version of SWI-Prolog.

First install SWI-Prolog. In school-situations you should install SWI-Prolog on a server.

Then unzip the HTML-Manual of XPCE into the SWI-Prolog-directory /doc. During unzipping the corresponding folder UserGuide is automatically created.

Installation of SWI-Prolog-Editor

The bit version of SWI-Prolog-Editor must be identically to the bit version of SWI-Prolog.

For personal usage you use this setup program:

For usage in a classroom-environment you do this: After the download of the SWI-Prolog-Editor in the

you unzip the files into a temporary folder und execute the setup.exe program.

The installation-program has special support for school-situations. It is possible to install the SWI-Prolog-Editor local or on a server. You can choose the folder for installation

At the end of installation you execute SWI-Prolog-Editor to initialize the registry or INI-files. Control the configuration in menu Window|Configuration.

Installation on a server

First install SWI-Prolog-Editor from one client on the server. From each other client you start the setup-programm from the server and choose Connect to create a desktop-icon and an entry in the start menu.

Installation in INI-Files

If user-configurations can't be saved in the Windows-Registry because of protector-cards you install SWI-Prolog-Editor with INI-Files support.

With this type of installation the INI-file SWIMachine.INI is created in the installation-folder with the system-specific configuration in the tabsheets Program and Documentation. If SWI-Prolog-Editor recogniceses during startup this INI-File in it's start-folder, he uses the configuration from this INI-file instead from the Windows-Registry.

The user-specific configuration are stored in other folders in INI-files. I suggest to use the home-directories of the users, because there is write-access. The home-directory should be accessible on a local drive, by a mapped network drive or direct by UNC-folder-naming. If necessary you can use the variable %Username% in the destination folder for the user-specific folder.

After installation and configuration the administrator can set the INI-files in the installation-folder to read-only. So pupils cannot change configuration of the system-specific configuration.


For deinstallation you execute setup.exe in the installation-folder. After deinstalltion you manually delete setup.exe.


The SWI-Prolog-Editor also supports the XPCE-System, with which you can write Windows-Programs. In particular graphic outputs are possible. The following applications of the XPCE-Systems are offered:


SWI-Prolog is an outstanding Prolog-implementation of Jan Wielemaker. For use in school the console-mode isn't really suitable. The SWI-Prolog-Editor is a pupil-oriented and instruction-suited development environment for work with SWI-Prolog.


In the illustration you can see the program-window of the SWI-Prolog-Editor with menu- and symbol-border. In the left window the Prolog-program family.pl is loaded, the right window shows the contents of the SWI-Prolog-help.

Beneath is the SWI-Prolog-window, which currently is answering the question?- parent(X, maria).


The File-Menu has in addition to the standard-operations like new, open, save and print, the export-operation in HTML- and RTF-format. This enables pupils to use the syntaxhighlighting in their documentation and teachers to use it for classwork.

Edit-Menu and Editor-Symbols

The Editor supports the Windows-clipboard, search and replace functions with multilevel undo-facilities. Via symbols one can place and seek bookmarks, line-numbers are showed optionally. If the cursor is positioned direct in front of a bracket, you can jump with the bracket-symbol to the corresponding second bracket. Marked textblocks may be un-/indented, un-/commented or copied to the clipboard in text-, HTML- or RTF-format.


With the consult-operation of the Start-Menu or the corresponding symbol you can consult the prolog-program in the active window. With doubleclick on a error-message or -warning or with the context-menu of the SWI-Prolog-Window the cursor is positioned on the errorline in the sourcecode.

When dealing with a query the commands continue and cancel are activated. So you can ask for another solution or cancel the query.

If necessary one can start SWI-Prolog new via the command restart.


With the commands in the Test-Menu you execute a programm in trace-modus in steps, set or reset breakpoints and display the call-stack.


Besides the standard window-commands like arrange, open and close windows, you can choose the desired font and execute the configuration-facility:


The path to the SWI-Prolog-directory must be set. You do this by using the Select-button as the other paths will be are adjusted accordingly. Based on the Prolog-Folder the dependant documentation-directories will be determined.

Parameter is the command-line option for SWI-Prolog. By default 32 MB are reserved for the local stack.


Here you configure the directories for the commands in the Help-Menu.

You can also use the Online-Documentation:

For better performance the used documentation-files are cached, which means locally saved. By default as cache-folder C:Documents and Settings\Application DataSWI-Prolog-EditorCache is used.


The Tab width is adjustable. With activated Smarttabs the tab-key will automatically position the cursor at the next word-beginning of the previous line.

Indent is used for marked textblocks.

Autoindent places after pressing the return-key the cursor at the position of the first nonspace character of the previous line.

The Author will be automatically carried over if you create a new prolog-file.

With Encoding you set the default encoding of new source-files.

Under Structure you define how predicates, facts and rukes are shown in the file-structure.


On this tab you activate the code-completion and parameter-hints and define the delay in milliseconds. The code-completion is activated with the tab-key. It shows all predicates which start with the previously entered letters.

For code-completion the Prolog-Documentation must be installed.


Here you can configure the colors for the syntax-highlighting.

If you choose a syntax-element on the left side, it's color and textattributs are shown on the right. Click on the desired colors and textattributes. The button Standard resets all colors to the standard-colors.


If the internet-explorer is installed you can use it internally in SWI-Prolog-Editor to display the documentation.

If you wish to use the browser externally the functions of Browser-Title and Alt-Keys for "File open" in Browser are required. The SWI-Prolog-editor checks first whether the standard-browser is already loaded. To do this it uses the browser-titel, for example Netscape Navigator or Internet Explorer. If the standard-browser is already loaded, the HTML-file to be showed is placed in the addressfield of the command File open. To achieve this the File-Menu is activated with Alt-F und O chooses the open-command. So one needs FO in the corresponding input field.


Here you set the Printing-Parameters

Header and footer are separated in three sections, left, middle and right. The #-character is used for separating the sections. Besides fixed Text you can use the following variables to print some special elements:

%FILE% the filename
%PATH% the filename inclusive the folder
%DATE% the date of printing
%TIME% the time of printing
%PAGENUM% the page-number
%PAGECOUNT% the total amount of pages

Here you have some options

With the option Integrated SWI-Prolog-Window you can choose between the integrated and the original SWI-Prolog window.

In the setting Return to continue, the next solution can also be requested with the Return key, which is easier than the standard ";".

It is advised to activate .pl-files link with SWI-Prolog-Editor. So you can open pl-files in the windows-explorer with doubleclick.

When saving, automatic backup files with the file extension BAK can be created.

The write protection can be automatically removed from Prolog files that have been copied from a CD, for example.

Deactivate the option prompt alternative groundness so that you receive a true or false result even for queries without variables.

Finally, a language file can be selected.


The Help-Menu gives you access to the documentation of SWI-Prolog and XPCE. You can organize the help with own favorites.

If the cursor is placed over a predefined predicate the indexsearch F1 shows the corresponding description from the HTML-documentation.


The Editor is based on the SynEdit-Komponente. Besides the usual editor-functions it serves indent- and unindent of textblocks (shift+ctrl+I [indent] bzw. shift-ctrl-U [unindent]), delete line (ctrl+Y), delete to end of line (shift+ctrl+Y) and administration of ten bookmarks (set/delete shift+ctrl+#, jump ctrl+#). You can set and delete bookmarks directly in the bookmark-column.