/prolog-viz

The best Prolog visualizer

Primary LanguageJavaScript

prolog

The best Prolog visualizer https://cdglabs.github.io/prolog-viz

Usage

Grammar

Prolog {
  Program
    = Rule* Query

  Rule  -- a rule
    = Clause ':-' Clauses '.'  -- body
    | Clause '.'               -- noBody

  Query  -- a query
    = Clauses '?'

  Clause  -- a clause
    = symbol '(' Term (',' Term)* ')'  -- args
    | symbol                           -- noArgs

  Clauses
    = Clause (',' Clause)*

  Term
    = Clause
    | List
    | variable

  List
    = '[' ']'           -- empty
    | '[' Contents ']'  -- nonEmpty

  Contents
    = Term ',' Contents  -- cons1
    | Term '|' Term      -- cons2
    | Term               -- single

  variable  -- a variable
    = upper alnum*

  symbol -- a symbol
    = lower alnum*

  tokens
    = (variable | symbol | _)*
}

Credit

Authors:

  • Zhixuan Lai
  • Alessandro Warth

Made possible by: