gprolog
GNU Prolog compiler and interpreter
TLDR
Start GNU Prolog interpreter
$ gprolog
Load and run file$ gprolog --consult-file [program.pl]
Compile to executable$ gplc [program.pl] -o [program]
Run query from command line$ gprolog --query-goal "[goal]"
SYNOPSIS
gprolog [options]gplc [options] files
DESCRIPTION
GNU Prolog is a Prolog compiler with constraint solving over finite domains. It compiles Prolog to native code and provides an interactive interpreter.GNU Prolog supports ISO Prolog with extensions for constraint logic programming, making it suitable for combinatorial problems, scheduling, and AI applications.
PARAMETERS
--consult-file file
Load Prolog file at startup.--query-goal goal
Execute goal after loading.--init-goal goal
Execute initialization goal.--entry-goal goal
Entry point goal.--no-top-level
Exit after executing goals.
INTERPRETER COMMANDS
$ ?- consult('file.pl'). % Load file
?- listing. % Show predicates
?- halt. % Exit
?- trace. % Enable tracing
?- listing. % Show predicates
?- halt. % Exit
?- trace. % Enable tracing
COMPILING
$ # Compile to executable
gplc program.pl -o program
# Produce WAM file
gplc -W program.pl
# Strip executable
gplc program.pl -o program -s
# Compile without top-level
gplc --no-top-level program.pl -o program
gplc program.pl -o program
# Produce WAM file
gplc -W program.pl
# Strip executable
gplc program.pl -o program -s
# Compile without top-level
gplc --no-top-level program.pl -o program
CAVEATS
Syntax differs slightly from SWI-Prolog. Native compilation adds startup complexity. Constraint solving requires finite domain declarations. Interactive debugging requires trace mode.
HISTORY
GNU Prolog was created by Daniel Diaz at INRIA, first released in 1996. It emphasizes native code compilation and constraint solving, distinguishing it from interpreted Prolog systems.
