SWI-Prolog's emulation of XSB depends on the XSB preferred file name
extension .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 begin_of_file
.
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 library(library/dialect/xsb/gpp)
.
This require gpp to be accessible through the environment
variable PATH
or the file_search_path/2
alias path
. We refer to the gpp
library for
details.