Logic & Functional

Prolog Playground

Declarative logic programming - facts, rules, queries, backtracking.

Runtime: Tau Prolog (pure JS)

Program (facts and rules)

Query

Up to 50 answers are shown. End the query with a . (added automatically if missing).

About this playground

Prolog playground using Tau Prolog, a pure-JavaScript Prolog interpreter. Define facts and rules in the top pane, type a query (no trailing dot needed), see every answer the system produces via backtracking. Classic ISO Prolog with the core operators and built-ins.

FAQs

Which Prolog standard?

Tau Prolog implements a large subset of ISO Prolog - cut, negation-as-failure, lists, assert / retract, the standard arithmetic and comparison operators. It doesn't ship the full SWI library, but is enough for classroom and book examples.

What's the difference vs SWI-Prolog?

SWI is a much larger native implementation with debuggers, modules, and many extra libraries. Tau is browser-native and lightweight - good for learning and demos, not production logic apps.

How are answers displayed?

Each successful binding is shown as a row. After the last answer the system reports 'no more answers' or 'false' if there are zero.

Other playgrounds