Skip to content
SWI-Prolog Clingo interface
C Prolog Python Makefile Shell
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.

Clingo ASP Solver binding for SWI-Prolog

This repository contains work in progress for embedding the Clingo ASP solver in SWI-Prolog. To use this, you need:

  • Clingo. You need clingo version 5, which is available on github:

    git clone
  • A recent copy of the development version of SWI-Prolog (7.3.x)

Please consult the file INSTALL in the downloaded clingo version and build the target libclingo as shown below. Omit --build-dir=release to compile the debug version.

scons --build-dir=release libclingo

After both SWI-Prolog and Clingo are installed, edit the Makefile to suit your installation. See instructions in the file. After that running make should suffice to build the interface. The interface may be tested by running e.g.:

./ examples/
?- map_color(Colors).

Finally, the system is installed as a SWI-Prolog library using make install.


The basic communication is working. Please do not expect the current interface to be stable. Currently, the interface allows for creating a Clingo program from a string or loading one from a file or from a (not yet settled) representation as a Prolog term. The program can be asked for its stable models (if any) on backtracking. A model is represented as a Prolog list of ground atoms in the predicate logic sense. The interface suppors Clingo's abilities to deal with external data and a changing world:

  • Clingo atoms may refer to a Prolog predicate
  • Clingo's support for parameterized grounding is supported
  • Clingo externals are supported
  • Clingo assumptions are supported


  • Inspect and set configuration options
  • Clingo will provide access to the AST (Abstract Syntax Tree) which allow for:
    • Specifying Clingo source using Quasi Quotation fragments
    • Pass identifier, string and variable values that are valid Prolog atoms, strings or variables, but invalid in Clingo's syntax.
  • More high level interaction.

Further reading:

You can’t perform that action at this time.