/Prolog

An attempt to implement a prolog interpreter in pharo

Primary LanguageSmalltalk

Prolog

Another attempt to start a project that has low odds of being finished ever. This is my trial of understanding and implementing a prolog interpreter. I try to keep my struggles not only in code but also in this readme.

  • started test hierarchy to test parser model
  • added more tests for the grammar
  • add tests for unification
  • implement operator model
  • add tests for complex compound terms
  • add test for member/2
  • add test for append/3
  • collect examples to parse for making basic grammar more solid
  • understand lists. How to implement comman lists and hole lists best???

2020-06-24

Solve left recursion problem with prefix and infix compound terms. Unification attempts

  • understand compound terms (Xfix notation)
  • infix, postfix, etc. operators in prolog are special entities with configuration of Xfix notation and precedence
  • so my conclusion is to start with petit parser that can parse a family tree knowledgebase
  • first working unification between simple compound terms. Straight unification by double dispatch through the structure
  • terms now have a parent pointer to be able to identify the top term
  • unification on call is difficult. Call contexts are bound to the term issued caller->callee. Unification uses respective terms to resolve variables in their own call context
  • add more tests for grammar
  • add tests for unification

2020-06-22

Clear up terminology to be able to name the parser rule accordingly

  • understand basic terminolgy
  • term is the driving term ;) for the syntax
  • a term can be an atom, a variable, a number or a compound term
  • compound terms are either prefix where the leading atom is called functor or
  • repository needs baseline to be loaded (including petit parser)
  • understand compound terms (Xfix notation)

2020-06-20

Starting all over. After the prolog class I need to clarify terminology. Prolog tends to have a lot of terms to describe things on different axes. Insights collected so far (if checked I think the code can do this already):

  • understand basic terminolgy

Links: