Playground
Type Datalog facts and rules below and hit Run. The program is evaluated entirely in your browser by the real C engine, compiled to WebAssembly — no server, no filesystem. The goal relation’s tuples are streamed back as plain text.
Output
(no results)
Supported subset
The in-browser engine supports the in-memory feature set of the language:
- Facts — bare lowercase symbols, double-quoted strings, integers, and flat list literals (elements are single values; nested lists aren’t yet accepted in a fact).
- Rules — including recursion (semi-naive fixpoint),
stratified negation (
!q(X)), and conjunctions. - Aggregates —
count(),sum(),min(),max(). - Equality & comparisons —
=,<<=>>=!=. - Arithmetic —
+-*/%. - Strings —
concat,length,lower,upper,prefix,suffix,contains. - Lists —
cons,car,cdr,append,member,[X|Xs]patterns. - Range predicate —
range(X, Rel, Lo, Hi). - Regex pattern walks — the
~ '...'form.
Not supported in the browser: publish/snapshot, time-travel
(as-of) queries, variadic relations, and the WAL / incremental-maintenance
API — all of which require the disk-backed engine.
Rendering caveat: the engine uses the CLI’s value heuristic, so a raw integer result (including one inside a list literal) that happens to equal a small symbol id can display as that symbol instead of the number. This is the documented B6 int-vs-symbol collision — a display heuristic, not a bug. Examples above use integer data to stay unambiguous.
The WebAssembly bundle is rebuilt from the C source with
make wasm; see docs/README for details.