Skip to content

Latest commit

 

History

History
71 lines (56 loc) · 1.52 KB

README.md

File metadata and controls

71 lines (56 loc) · 1.52 KB

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: