LinuxCommandLibrary
GitHubF-DroidGoogle Play Store

swipl

SWI-Prolog logic programming interpreter

TLDR

Start interactive
$ swipl
copy
Load file
$ swipl [program.pl]
copy
Run goal and exit
$ swipl -g "[goal]" -t halt [program.pl]
copy
Query from command line
$ swipl -g "[member(X,[1,2,3]),writeln(X)]" -t halt
copy
Compile to standalone
$ swipl -o [output] -c [program.pl]
copy

SYNOPSIS

swipl [-g goal] [-t goal] [-o output] [options] [files]

DESCRIPTION

swipl is the interpreter and compiler for SWI-Prolog, one of the most comprehensive and widely used Prolog implementations. It provides an interactive REPL for querying facts and rules, loading Prolog source files, and compiling standalone executables.SWI-Prolog includes an extensive standard library with support for constraint logic programming (CLP), definite clause grammars, multi-threading, HTTP server framework, and interfaces to databases and other languages. It supports both interactive development and deployment as compiled applications.The system can execute goals from the command line, load source files, and create standalone executables using the -c flag. It is widely used in academic research, natural language processing, and knowledge representation systems.

PARAMETERS

-g GOAL

Goal executed before entering the interactive top level. May appear multiple times.
-t GOAL
Use goal as the interactive top level instead of the default prolog/0 (commonly halt for scripts).
-o FILE
Specify the output file when used with -c.
-c FILES
Compile files into an intermediate code (saved state) file.
-s FILE
Load file as a script after initialization.
-f FILE
Use file as the initialization file instead of the default init.pl. Use -f none to skip init.
-l FILE
Load file (compatibility with other Prolog systems).
-x BOOTFILE
Boot from an alternative saved state.
-O
Enable optimized compilation.
-D NAME[=VALUE]
Set a Prolog flag.
--stack-limit=SIZE
Limit combined Prolog stack size (suffix b, k, m, g).
-q, --quiet
Suppress informational messages and startup banner.
--version
Print version and architecture.
--help
Print brief help summary.

CAVEATS

Prolog syntax unique. Logic programming paradigm. Learning curve.

HISTORY

SWI-Prolog was started by Jan Wielemaker in 1987. It's one of the most widely used Prolog implementations.

SEE ALSO

gprolog(1), sicstus(1), yap(1)

Copied to clipboard
Kai