DEV Community

loading...

What is List Prolog?

luciangreen profile image Lucian Green ・2 min read

First, what is an Interpreter?
It runs code in a language I wrote called List Prolog. What is List Prolog? Everything in the language is a list (Prolog's main input and output format), including the algorithm to run.

List Prolog Reverse Algorithm

So, what can List Prolog do?

It can

  • run code with predicates
  • run recursive code
  • parse grammars, useful for file parsing and converting atoms (strings) to terms (lists)
  • Users can use it as a research tool. One of my favourite features is the lists in List Prolog because you can double-click on a bracket in a pair in BBEdit and it selects the whole phrase. This helps with bug-checking. The lists enable the interpreter to process all data including the algorithm as lists, so it can easily generate code using an algorithm.
  • It has faster variable naming than Prolog's string manipulation of variable names (i.e. upper to lower case).

Suppose someone asked me why I chose to write "List Prolog Interpreter" in Prolog. I wrote List Prolog in Prolog to write CAWP. That word does not mean "copy", but "Combination Algorithm Writer with Predicates". This is an induction, or rule finding algorithm. I needed an interpreter that CAWP used. I considered using my Interpreter from Uni days, but it couldn't handle predicates and I wanted to customise it. Lists were the way to go.

Actually, one of my past programs, Database Formula Finder inspired List Prolog Interpreter. It uses logic, not unlike Prolog, to select data from tables. I wanted to write Database Formula Finder because I wanted to write a way to program a database language in Prolog. I noticed that lists worked well as a computer language in Prolog when processing lists.

See how Database Formula Finder inspired List Prolog Interpreter: https://www.youtube.com/watch?v=dVOUz74Kwlk&t=13s

Working on the Interpreter has taken years and I have been using the time to write algorithm ideas that might be easier to write with the interpreter, which e.g. find errors as you type.

Another feature of List Prolog is the Grammars. They can parse a file with a particular structure. So I made a video about how grammars work in List Prolog. It is a snapshot of what grammars are (and how they help parse and answer questions).
See the Grammars working at: https://www.youtube.com/watch?v=HBB6NWCxu3I&t=33s

Conclusions

How can I run the List Prolog Interpreter? Anthropology influenced me to write the Interpreter while studying to write an algorithm that could write algorithms, like a boat.

See https://github.com/luciangreen/listprologinterpreter

What can I do with the List Prolog Interpreter? Can it write algorithms?
Studying Theology inspired me to write CAWP, an algorithm that could write algorithms, like a leader.
See https://github.com/luciangreen/Combination-Algorithm-Writer-with-Predicates

Discussion (1)

pic
Editor guide
Collapse
luciangreen profile image
Lucian Green Author

I recently created the new Combination Algorithm Writer with Multiple Predicates Repository (github.com/luciangreen/Combination...) which can create its own recursive code and base cases.