# datalog-dafsa $ dl query 'tc(X,Y) :- edge(X,Y).' tc

Playground

Playground

// the real engine, in your browser

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.

Supported subset

// the in-memory feature set

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 are not yet accepted in a fact).
  • Rules -- including recursion (semi-naive fixpoint), stratified negation (!q(X)), and conjunctions.
  • Aggregates -- count(), sum(), min(), max().
  • Equality and 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.

Rebuild

// make wasm

The WebAssembly bundle is rebuilt from the C source with make wasm; see the repo for details.