swipl(1)
π swipl β the SWI-Prolog girlies' manual (General Commands Manual, section 1)
okay so bestie, welcome to the swipl(1) page π¦ this is the command you type to summon SWI-Prolog 10.0.2 into existence. it's giving main character energy for the whole Prolog ecosystem, and we're gonna walk through it together, no cap β¨
β¨ NAME β¨
swipl β SWI-Prolog 10.0.2 π (yes the version number is right there in the name, she's not shy)
πΈ SYNOPSIS πΈ
swipl [--help|--version|--arch|--dump-runtime-variables]
swipl [options] prolog-file ... [--] [arg ...]
swipl [options] [-o output] -c file ...
swipl [options] [-o output] -b initfile ...
so like, there are four whole moods here and they do completely different things, let me break it down π
- the first one? that's the info-drop version. it tells you stuff about the system and then immediately dips, like "k bye" π
- the second one is the one you'll be living in, fr fr. it's the primary way to call Prolog on one or more Prolog source file(s), and you can pass arguments through to the application β the app can grab them with
current_prolog_flag(argv, Argv)π₯ - the third one is for creating a saved state π«Ά
- and the last one is for boot-compilation of the Prolog parts of the system. iykyk, that's the deep lore π
π DESCRIPTION π
okay so picture this: SWI-Prolog is a comprehensive and stable implementation of the Prolog language, and she comes with a large set of libraries. like, a whole wardrobe π
among its distinguishing features β and bestie, these are the iconic ones:
- mature support for multi-threading π§΅
- a mature embedded web-server library π
- graphical development tools β the debugger, profiler, cross-referencer, and editor π¨
- an embedded efficient RDF store π
- support for XML/SGML/HTML and Unicode π
and the more widely supported features, because she contains multitudes:
- support for constraint programming
- atom garbage collection ποΈ
- interfaces to databases (ODBC), C, C++, and Java (JPL) π
also, SWI-Prolog implements the ISO core standard β β yes, she follows the rules. but also, many of its extensions are largely compatible to YAP and SICStus Prolog, so if you're coming over from those, you're gonna be fine π
real talk though: this manual page only lists the commandline options. that's it. that's the whole assignment here.
full documentation is available on-line, plus in HTML and PDF format, from the WWW home page at http://www.swi-prolog.org πΈ go look, she's got range
β¨ OPTIONS β¨
okay bestie, this is the big one, the main character list π every single flag, no skips, let's go
--helpβ gives you a lil summary of the most important options. just the hits π--versionβ shows off the version and architecture info. slay, who is she? π--abi-versionβ prints the ABI version key. this key is literally the thing that tells you whether different interfaces are binary-compatible with each other π¦--archβ prints the architecture identifier. that's it, that's the whole vibe π--dump-runtime-variables[=format]β dumps info that's generally useful for installation scripts, in whatever form format says. the defined formats aresh(the default, bourne shell) andcmd(Windows CMD).swipl-ld(1) uses this to grab the deets it needs about Prolog. you normally call it like this:
eval `swipl --dump-runtime-variables`
which sets these shell variables, no cap:
CCβ the C-compiler used to compile SWI-Prolog.PLBASEβ the home directory of SWI-Prolog. same value as what thecurrent_prolog_flag homereturns.PLARCHβ the architecture identifier in use. together withPLBASEthis pins down where all the components live. for example, the library for embedding is in$PLBASE/lib/$PLARCH/libswipl.aPLBITSβ address bits for the VM. either32or64.PLLIBβ theCCidentifier to link against SWI-Prolog. typically-lswiplPLLIBSWIPLβ the full path name to the shared object (DLL) that provides the Prolog core.PLLIBSβ additional libraries needed for linkingPLLIBPLCFLAGSβ flags you need to pass to the C-compiler to generate compatible code.PLLDFLAGSβ flags you need to pass to the C-linker for linking embedded executables.PLSOEXTβ the extension the hosting OS uses for shared objects. on most Unix systems this is"so"; on MS-Windows it's"dll". AIX uses"o", HPUX uses"sl".PLSOPATHβ the environment variable the hosting OS uses to extend the search path for shared objects. for example, on ELF systems this is"LD_LIBRARY_PATH"and on MS-Windows it's"PATH".PLVERSIONβ numeric representation of the SWI-Prolog version.PLVERSIONTAGβ if present, a version tag like"rc1".PLSHAREDβ has the valueyesif Prolog supports linking shared libraries usingload_foreign_library/[1,2]andnootherwise.PLTHREADSβ has the valueyesif Prolog was compiled for multi-threading andnootherwise.
--home=DIRβ useDIRas the home directory π--stack-limit=size[bkmg]β sets the combined stack limit to size bytes. the suffix is case insensitive and says what the unit is:b(bytes),k(Kbytes),m(Mbytes) org(Gbytes) π--table-space=size[bkmg]β sets the table space limit for SLG resolution (tabling) to size bytes. same suffixes as--stack-limitβ¨--shared-table-space=size[bkmg]β sets the table space limit for shared tabling to size bytes. again, same suffixes as--stack-limitπ«-Oβ optimised compilation. go peepset_prolog_flag/2in the SWI-Prolog Reference Manual for the tea π₯-b initfile ... -c file ...β boot compilation. theinitfile ...ones get compiled by the C-written bootstrap compiler, andfile ...get compiled by the normal Prolog compiler into an intermediate code file. heads up bestie: this option is for system maintenance and is given for reference only π§-c file ...β compilefile ...into an intermediate code file.-d levelβ set debug level to level. also for system maintenance, given for reference only π οΈ--packs[=bool]β disable attaching extension packs (aka add-ons).--pce[=bool]β disable the XPCE GUI subsystem.--pldoc[=port]β starts the PlDoc documentation system on a free network port and launches your browser onhttp://localhost:port. if port is given, the server starts at that port but the browser does not get launched. no auto-open, you're on your own π¦-f fileβ usefileas the initialisation file instead ofinit.pl. and-f nonestops SWI-Prolog from even searching for an initialisation file π-F fileβ pick the startup script from the SWI-Prolog home directory.filegives the base-name of the script, and the extension is.rc. the default script gets deduced from the basename of the executable, taking all the leading alphanumerical chars (letters, digits and underscore) from the program name. so if the program is namedswi-2.0it'll try to load the fileswi.rcfrom the SWI-Prolog home directory. if the file doesn't exist, or you don't have read-access to it, the script is silently not loaded. ghosted, basically π-s fileβ loadfileas a script. you can use this from the shell to make Prolog load a file before it enters the toplevel. deprecated though, since file names with a Prolog extension (.plor.qlf) are used to load the program π-l fileβ loadfileas a script. this is a synonym for-sthat plays nice with several other Prolog implementations. if you pass multiple-sor-larguments, all the specified files get loaded in the order they appear on the argument list π--quiet[=bool],-qβ operate silently. suppresses all informational messages. the introvert flag π€«--debug[=bool]β disable generating code that can be debugged usingtrace/0,spy/1, etc.--debug-on-interrupt[=bool]β immediately start handlingSIGINT(Control-C) to start the debugger. by default this is enabled when the interactive toplevel is entered β‘--on-error=styleβ how to handle a (printed) error message. default isprint, which causes errors to be printed while execution continues. usingstatuscontinues just likeprint, buthalt/0makes the process exit with status 1 β andhaltmakes the process exit with status 1 on the first error π¨--on-warning=styleβ same energy as--on-error, but for warning messages β¨-g goalβ goal is executed right before entering the top level. this option can appear multiple times, and goals are executed in the order they appear. possible choice points get pruned. if a goal fails, an error is printed (depending on the-qflag) and the process stops with exit code 1. if a goal raises an exception, the error is printed and the process stops with exit code 2. if no goal is present,version/0is called to write the welcome message β so you can suppress the welcome message by giving-g true. goal can be a complex term, and in that case you'll normally need quotes to protect it from being expanded by the Unix shell π-o outputβ used together with-bor-cto determine the output file for compilation.-p alias=pathlistβ define a path alias forfile_search_path/2.pathlistis a":"separated list of values for the alias. peepfile_search_path/2in the SWI-Prolog Reference Manual for more π-t goalβ use goal as the interactive top level instead of the default goalprolog/0. goal can be a complex term. if the top level goal succeeds, SWI-Prolog exits with status 0. if it fails, the exit status is 1. this flag also determines the goal started bybreak/0andabort/0. and if you wanna stop the user from entering interactive mode, start the application with-g goaland givehaltas the top level π-x bootfileβ start from an intermediate code file that resulted from a Prolog compilation using the-bor-coption, or that was created usingqsave_program/[1,2]π¦--tty[=bool]β switches tty control (usingioctl(2)). normally tty control is switched on, and this default depends on the installation. you might wanna switch tty control off if SWI-Prolog is used from an editor like GNU Emacs. if it's switched off,get_single_char/1and the tracer will wait for a carriage return β¨οΈ--win-appβ this option is available only inswipl-win.exe. the Start menu shortcut uses it to change the working directory to...\Documents\Prolog. thePrologsubdirectory will be created if it doesn't exist πͺ--signals[=bool]β disable handling of signals. often used when SWI-Prolog is embedded in another application on Unix systems π‘--sigalert=NUMβ useNUMfor unblocking system calls. default isSIGUSR2. using0disables installing a signal handler, delaying the delivery of thread signals until the blocking system call completes β³--threads[=bool]β disable creating threads in the multi-threaded version. notably this prevents running global garbage collection on a separate thread, and it may be used for situations where multiple threads are not desirable π§΅--traditionalβ disable SWI-Prolog version 7 extensions that are incompatible with earlier versions. old-school mode, vintage vibes π--β stop scanning for more arguments. that's the cut, periodt βοΈ
πΈ ENVIRONMENT VARIABLES πΈ
SWI_HOME_DIRβ the location for finding the startup file and the libraries. normally discovered from the executable or the configured default location. providing the value through the environment may be needed if SWI-Prolog is embedded into another executable π‘
π ON-LINE HELP π
SWI-Prolog has on-line help, and it's honestly iconic. it gives you a fast lookup and browsing facility for the SWI-Prolog Reference Manual, and the on-line manual can show predicate definitions as well as entire sections of the manual π¦
helpβ equivalent tohelp(help/1).help(+What)β show a specified part of the manual.Whatis one of:Name/Arityβ give help on the specified predicate π―Nameβ give help on the named predicate with any arity, or a C interface function with that name πSectionβ display the specified section of the SWI-Prolog Reference Manual. section numbers are dash separated numbers: e.g.2-3refers to section 2.3 of the manual π
if Prolog is used together with the GUI tool XPCE, these predicates start a graphical interface, giving you a coherent interface to help/1, apropos/1 and explain/1 β¨
π FILES π
okay so bestie, this particular install of SWI-Prolog got built with the configure option --prefix=/usr. iconic. that means everything should live where we say it lives below. but if the files are NOT chillin' at the spot we promised? red flag π© β the install has probably been moved around. no stress, you can always find your local install directory with this lil query:
?- current_prolog_flag(home, Home).
~/.config/swi-prolog/init.plβ your personal initialisation files, which SWI-Prolog peeks at on startup. π the exact location depends on the OS, so don't @ me if it's somewhere slightly different on your machine.
π SEE ALSO π
- the SWI-Prolog web-home at
http://www.swi-prolog.org⨠- Jan Wielemaker, SWI-Prolog Reference Manual at
http://www.swi-prolog.org/pldoc/index.htmlπ - William F. Clocksin & Christopher S. Mellish, Programming in Prolog, fourth edition, Springer Verlag, Berlin 1994. π
swipl-ld(1)π
π WARRANTY π
ngl bestie, this is the part where the lawyers speak, and they are not playing. listen up:
The software is provided as is, without warranty of any kind, express or implied, including but not limited to the warranties of merchantability, fitness for a particular purpose and non infringement. In no event shall the author or his employer be liable for any claim, damages or other liability, whether in an action of contract, tort or otherwise, arising from, out of or in connection with the software or the use or other dealings in the software.
fr fr: no warranty, no liability, no take-backs. it's giving "you're on your own, but lovingly." π
π LICENSE INFORMATION π
SWI-Prolog is distributed under the Simplified BSD or BSD-2 License. π a particular configuration may contain components that are subject to other license conditions. use license/0 to find components with less permissive license conditions. see the SWI-Prolog license page at http://www.swi-prolog.org/license.html for details. π¦
π COPYRIGHT π
Copyright (c) 1986-2020 University of Amsterdam, VU University Amsterdam
πΈ AUTHOR πΈ
Jan Wielemaker
and that's the whole page, bestie, you made it to the end π«Άβ¨ this was the SWI-Prolog 8 manual, dated Oct 10, 2020, section swipl(1) β go forth and slay your Prolog, you absolute main character π
π
π¦ where this page comes from
- fedora 44: swi-prolog-core 10.0.2-1.fc44 Β· BSD-2-Clause AND (Brian-Gladman-3-Clause OR GPL-1.0-or-later) AND BSD-3-Clause AND dtoa AND LicenseRef-Fedora-Public-Domain AND MIT AND Unicode-DFS-2016 AND Zlib
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms