answer-set-programmingclingogringo

Use Clingo 4.5 with Gringo 3


I am trying to run the code from the exercises from Chapter 8 of the PCGBook. They use clingo but don't say what version they are using. When I downloaded the latest version of Clingo from Potassco's sourceforge (version 4.5.4), it gives me lexer errors. I assume this is because the syntax has been changed between Gringo 3 and Gringo 4. On the Potassco website they say this and give a remedy for fixing it by downloading both versions of Gringo, but they don't say how to have both referenced when running programs with Clingo. I downloaded Gringo 3.0.0 and replaced the gringo.exe, but the clingo.exe has been compiled with the latest version of Gringo.

How do I download the latest version of Clingo, or the latest compatible version, with Gringo 3?


Solution

  • Clingo is the combination of the grounder gringo and the solver clasp, plus some extras. Note that version-wise gringo 3.x and clasp 2.x go together, and gringo 4.x and clasp 3.x go together. Clingo follows the versioning of gringo, so clingo 4.x combines gringo 4.x and clasp 3.x.

    You can get the latest clingo version that supports gringo 3.x syntax from here: https://sourceforge.net/projects/potassco/files/clingo/3.0.5/

    Alternatively you can get clasp 2.x to go with your gringo 3.x https://sourceforge.net/projects/potassco/files/clasp/2.1.5/

    As a tip, you can always run clingo in different modes with the --mode=<arg> switch. The argument options are clingo, clasp and gringo. This means that currently you really only ever need clingo 3.x and 4.x to be installed. On windows you could e.g. rename the 3.x version to clingo3.exe.