-
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.
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
https://www.swi-prolog.org/build/
. -
You may need to install gawk using Homebrew.
-
Install Translation Shell on Mac, etc. Change line in
culturaltranslationtool/ctt2.pl
trans_location("../../../gawk/trans").
to correct location of trans.
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.
- Download the LPPM Repository:
mkdir GitHub
cd GitHub/
git clone https://github.com/luciangreen/List-Prolog-Package-Manager.git
cd List-Prolog-Package-Manager
swipl
['lppm'].
lppm_install("luciangreen","SSI").
../
halt.
-
In Shell:
cd SSI
swipl
['ssi'].
-
You may need to replace
swipl
withswipl --stack-limit=1G
above to run tests 15 and 25.
You can learn List Prolog, SSI's programming language at List Prolog Documentation.
- 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:
ssi_test_all00("en",off,NTotal,Score).
ssi_test_all00("en2",off,NTotal,Score).
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(test_types_cases,6,"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
respectively.
- 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:
ssi_test_all_bt00("en2",off,NTotal,Score).
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(test_types_cases,6,"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
respectively.
- See note 1 above.
-
A low-code backend web Prolog service.
-
After loading
swipl
and[ssi].
, load State Saving Interpreter to run web apps withssi_server(8000).
and go tohttp://127.0.0.1:8000
in your browser. -
Modify the application to run, the window's title and background colour in
ssi-api.pl
. -
Before running on your server, change the API key in
api-key(1234567890).
inssi-api-key.pl
to a different API key. -
To delete old session files every month, run
swipl ssi-ws.pl
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, as follows:
read_password("password")
or,
[[n, read_password], ["password"]],
in List Prolog, where "password" should be changed.
See List Prolog Documentation.
Lucian Green - Initial programmer - Lucian Academy
I licensed this project under the BSD3 License - see the LICENSE.md file for details.