Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

patch-prolog

A standalone Prolog compiler. plgc compiles an ISO-subset Prolog program to a single native binary with zero runtime dependencies — no Rust toolchain, no interpreter, no serialized clause database. Predicates become native code via LLVM.

plgc build rules.pl -o my-linter      # ~676K standalone binary
./my-linter --query "violation(Field, Reason)"
echo $?   # 0 = no solutions (clean), 1 = solutions found

The compiled binary contains no clause interpreter — control flow is generated per predicate as native code, and only primitive services (heap, trail, unification, builtins, query parsing, output) come from a small runtime statically linked in. The result runs anywhere with libc/libm and nothing else.

The toolchain

Three binaries share the engine:

BinaryWhat it is
plgcThe compiler — build, run, and check your Prolog.
plgrAn interactive REPL that drives the compiler (never interprets).
plglA Language Server (diagnostics, completion, hover, go-to-definition).

Where to go next

  • Installation — install the toolchain and compile your first program.
  • Compiler Usageplgc commands, the query wire-contract, and exit codes.
  • REPL Guide, Language Guide, and the Builtin & Stdlib Reference follow as those pages land.