Prolog Interpreter in JavaScript!

To begin. First Click anywhere on the Black Screen to the right in order to start typing, and press enter to execute your code. Just like a terminal program! The parser will correctly parse prolog programs. And has logic implemented for the following:

  1. Clauses
    • Relations of the form atom(terms).
    • Example: dad(steve,mary).
  2. Definitions
    • Clauses with a head and a body.
    • Example: dad(X,Y) :- male(X), son(Y,X).
  3. Variables
    • Variables in prolog are any character / string that begins with an uppercase character
  4. Queries / Goals
    • In order to query the clauses entered, start a goal with '?-'
    • Example: ?-dad(steve,X). Will return X: mary

SHELL COMMANDS: Type these in order to perform commands that are built into the interpreter or prolog.

Unification Trace: