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.

INSTALL

sudo apt install swi-prolog-core
copy
sudo dnf install swi-prolog-core
copy
sudo zypper install swipl
copy

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)

Braincup
Open source brain training for math, memory and focus
Braincup mini-games
41 mini-games · Apache-2.0
No ads · No tracking
Play in browser
Download Braincup on the App StoreGet Braincup on Google PlayGet Braincup on F-Droid
276 stars
From the maker of Linux Command Library
Copied to clipboard
Braincup
Open source brain training for math, memory and focus. 41 mini-games, from mental arithmetic to Sudoku, N-Back and Solo Chess.
Apache-2.0 licensed · No ads · No tracking · No account
From the maker of Linux Command Library
Download Braincup on the App StoreGet Braincup on Google PlayGet Braincup on F-Droid