Prolog, the general-purpose deductive logic-programming language has been condemned to relative obscurity in the din of new programming languages and paradigms.



Yet, it remains alive and vital. Prolog is more intuitive, elegant than most special purpose query languages. It lets us express deductive queries more compactly and understandably (to rule out ultra-compact one-letter languages :) than any other query language.



Lispers (of all flavors) have observed this. They have awesome implementations of prolog-like features that can be embedded into their native programming systems [1,2].



I wanted to bring the same joy to the world of typed programming languages. I want to walk the community through the act of embedding Prolog as a query language into OCaml Systems. In this talk I present a starter kit towards implementing a Prolog in OCaml.



The main takeaways from my talk will be: Fashioning the internals of a query engine in OCaml. I will focus on unification and backtracking. Fashioning a query parser in OCaml in menhir tying the two together.



I intend to keep this talk very introductory and accessible to anyone with some familiarity with functional programming languages. Towards this goal, I will choose to focus on a very tiny subset of Prolog for my talk.



References.

[1] http://minikanren.org/

[2] https://github.com/swannodette/logic-tutorial­