Skip to content


Repository files navigation

State Saving Interpreter (SSI)


  • White hexagons on a black background.

  • With the State Saving Interpreter, users can save states of the interpreter between times and deprecate List Prolog Interpreter.

Getting Started

Please read the following instructions on installing the project on your computer for writing code.


  • Please download and install SWI-Prolog for your machine at

  • You may need to install gawk using Homebrew.

  • Install Translation Shell on Mac, etc. Change line in


to correct location of trans.

1. Install manually

Download this repository, List Prolog Interpreter (LPI) and the repositories which LPI is dependent on. The Languages repository enables SSI to be run in different languages.

2. Or Install from List Prolog Package Manager (LPPM)

mkdir GitHub
cd GitHub/
git clone
cd List-Prolog-Package-Manager


  • In Shell: cd SSI swipl ['ssi'].

  • You may need to replace swipl with swipl --stack-limit=1G above to run tests 15 and 25.

Learn Prolog with SSI

You can learn List Prolog, SSI's programming language at List Prolog Documentation.

Explanation of what it does

  • State Saving Interpreter (SSI), like List Prolog Interpreter, runs algorithms in the List Prolog language. List Prolog algorithms are lists, which can be more easily generated and analysed. SSI is different because it manually creates and follows choice points (allowing multiple possible solutions like Prolog) unlike List Prolog Interpreter, which relies on Prolog to manage choice points.
  • SSI was written to save the states of the Prolog interpreter.
  • It solves the problem of backtracking by saving states.
  • It works by manually storing and referring to choice points, records of the variable binding table and recursive states. These include "virtual" commands (commands such as member2 which compute all results when they are first run). The interpreter loads these choice points as the algorithm encounters flow through predicates, commands and recursion.
  • It supports the Higher-Order call Command.
  • SSI supports member2, stringconcat, nested findall, cut and the commands of List Prolog Interpreter.
  • SSI will enable running segments of a complex algorithm on a supercomputer and prevent data loss in low-power areas.


To run SSI-specific tests, run: only_ssi_test(off,NTotal,Score).

To run all tests (main, types, open and open types) in any language:


where "en2" is an English language with e.g. "concatenate strings" instead of stringconcat ("en", or see available language codes - see the Languages repository for instructions about how to install different languages).

To run a test from one of the primary, types, open or open types, run one of:

ssi_test_all01(test,            4,"en2",off,1,Passed).
ssi_test_all01(testopen_cases,  3,"en2",off,1,Passed).
ssi_test_all01(test_open_types, 5,"en2",off,1,Passed).

where the user should replace 1 with the test number from


  • Note 1: drag and drop contents of test_open_and_types_open_data/ into an empty file in BBEdit (Mac) to copy and paste into Terminal for tests with input.

To run all tests (main, types, open and open types) back-translating to and from any language:


To run a test from one of the primary, types, open or open types, run one of:

ssi_test_all_bt01(test,            4,"en2",off,1,Passed).
ssi_test_all_bt01(testopen_cases,  3,"en2",off,1,Passed).
ssi_test_all_bt01(test_open_types, 5,"en2",off,1,Passed).

where the user replaces 1 with the test number from


  • See note 1 above.

SSI Web Service

  • A low-code backend web Prolog service.

  • After loading swipl and [ssi]., load State Saving Interpreter to run web apps with ssi_server(8000). and go to in your browser.

  • Modify the application to run, the window's title and background colour in

  • Before running on your server, change the API key in api-key(1234567890). in to a different API key.

  • To delete old session files every month, run swipl using a scheduler in Linux, i.e. crontab -e.

  • Setting_up_a_VPS_with_TextToBr describes how to set up a Virtual Private Server, which can run Prolog over the web.

  • SSI Web Service contains few, but central commands for mainly AI-purposes in Prolog. For more tutorials, see my Lucian Academy YouTube Channel.

  • To comply with browsers' security requirements, only run SSIWS apps with a password screen.


See List Prolog Documentation.

SSI with Prolog queries


Lucian Green - Initial programmer - Lucian Academy


I licensed this project under the BSD3 License - see the file for details.