LinuxCommandLibrary

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

Initial goal.
-t GOAL
Top-level goal.
-o FILE
Output executable.
-c FILES
Compile files.
-s FILE
Load script.
--quiet
Suppress banner.

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)

> TERMINAL_GEAR

Curated for the Linux community

Copied to clipboard

> TERMINAL_GEAR

Curated for the Linux community