Lucianpedia Wiki

The State Saving Interpreter (SSI) is different from List Prolog Interpreter (LPI). However, both run List Prolog code and SSI saves variable and recursive states in memory.

SSI features[]

  • SSI converts List Prolog algorithms to a state machine (including a line numbering algorithm) for "game board"-style running of code, including -2 (true) and -3 (false) return values.
  • The state machine includes directions such as "on true", "go after", "on false", and "go to predicates".
  • Global variables, also included in the saved state, include predicate number (from the code) and predicate ID (from running the program) correspondences, skip states, and consist of interpreter globals.
  • SSI includes some of the List Prolog Interpreter commands and its own (such as member2 and stringconcat).
  • As against LPI, predicates with no arguments are converted from [[n, predicate]] to [[n, predicate], []], and can be called either way.
  • SSI includes if-then//2 and 3 - [[n, "->"]], not - [[n, not], Statement], findall - [[n, findall], Format_variables, Statements, Result_variables] and brackets - [[n, "[]"], Statements] commands.
  • The SSI Web Service allows non-deterministic List Prolog algorithms to be run in a web browser across several pages. It features text and a text form box written to the web page. The application to run, the web page title and background colour, etc. may be customised. With the curl command and the get, not post form method, the feature may be used to write an API in List Prolog. Prolog may be converted to List Prolog using one of Lucian Green’s converters on Github.

Updates[]

Green has developed a feature that computes multiple results from append (See Converting if-then in Prolog to multiple clauses with reification), e.g.

lucianpl(off,[[n,findall],[[[v,a],[v,b]],[[n,appendz],[[v,a],[v,b],[1,2,3]]],[v,c]]],[[[n,appendz],[[],[v,a],[v,a]]],[[n,appendz],[[[v,a],"|",[v,d]],[v,b],[[v,a],"|",[v,c]]],":-",[[[n,appendz],[[v,d],[v,b],[v,c]]]]]],R),writeln1(R). produces [[[[v,c],[[[],[1,2,3]],[[1],[2,3]],[[1,2],[3]],[[1,2,3],[]]]]]]

This feature allows SSI to find multiple results from predicates with findall outside reserved append and string_concat.

State Saving Interpreter Web Service as Low-Code[]

If low(er) code has fewer instructions than C, SSI-WS can fit the description. It could use Combination Algorithm Writer (CAW) or Types to Algorithm, related to SSI through List Prolog, to generate code from specifications. SSI-WS has visual web output, making it easier to access. It allows Prolog backtracking across multiple web pages.

References[]

  1. Converting if-then in Prolog to multiple clauses with reification https://stackoverflow.com/questions/75597081/converting-if-then-in-prolog-to-multiple-clauses-with-reification#comment133532589_75597081