Want to refresh my knowledge about Prolog. I am curious about is it possible to use Prolog for context-free string parsing? This task could help me to understand differences between Prolog and SMT solvers. I already implemented parser with Z3, I want to do the same with Prolog.

I have found that SWI-Prolog is popular enough. Let's start with it.

SWI-Prolog

Installing


$ sudo snap install swi-prolog

Launching


$ swi-prolog.swipl-win

Let's hack!

Books

There is nice book here: Simply Logical

Presentation about Horn clauses: Propositional logic: horn clauses

Ideas
  • use Prolog for component layout: describe margins, paddings, horizontal lists, vertical lists, etc. in logical language
  • Prolog database as a data structure; generalization of arrays, trees, maps, graphs, etc.
  • Toy programming language with Prolog (or Datalog) database instead of global variables