The best Prolog visualizer https://cdglabs.github.io/prolog-viz
- Tutorial: Slideshare, PDF, keynote
- Save the visualization to PDF by pressing ⌘+P
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 | _)*
}
- Zhixuan Lai
- Alessandro Warth