|Did you know ...||Search Documentation:|
|Notes on specific dialects|
The level of maturity of the various dialect emulation implementations varies enormously. All of them have been developed to realise portability for one or more, often large, programs. This section provides some notes on emulating a particular dialect.
XSB Prolog compatibility emerged from a project to integrate XSB's advanced tabling support in SWI-Prolog (see section 7). This project has been made possible by Kyndi.243This project was initiated by Benjamin Grosof and carried out in cooperation with Theresa Swift, David S. Warren and Fabrizio Riguzzi. The XSB dialect implementation has been created to share as much as possible of the XSB test suite as well as some larger programs to evaluate both tabling implementations. The dialect emulation was extended to support Pharos.244Pharos was used to evaluate incremental tabling (section 7.7), a protect with Edward Schwatz and Cory Cohen from CMU.
Emulating XSB is relatively complicated due to the large distance from the Quintus descendant Prolog systems. Notably XSB's name based module system is hard to map on SWI-Prolog's predicate based module system. As a result, only non-modular projects or projects with basic usage of modules are supported. For the development of new projects that require modules more advanced module support we suggest using Logtalk.
SWI-Prolog's emulation of XSB depends on the XSB preferred file name
.P. This extension is used by
library(dialect/xsb/source) to initiate a two phase loading
process based on term_expansion/2
of the virtual term
To load a project in both XSB and SWI-Prolog it is advised to make
sure all source files use the
.P file name extension. Next,
write a SWI-Prolog loader in a
.pl file that contains e.g.,
:- use_module(library(dialect/xsb/source)). :- [main_file].
It is also possible to put the able use_module/1 directive in your personal initialization file (see section 2.2), after which XSB files can be loaded as normal SWI-Prolog files using
% swipl file.P
XSB code may depend on the gpp
preprocessor. We do not provide gpp. It is however possible to
send XSB source files through gpp by loading
This require gpp to be accessible through the environment
PATH or the file_search_path/2
path. We refer to the
gpp library for
The XSB import directive takes the form as below.
:- import p/1, q/2, ... from <lib>.
This import directive is resolved as follows:
dialect/xsbdirectory of the SWI-Prolog library. If found, the predicates are imported from this library.