0.1.2 • Published 11 months ago

@nowarp/souffle v0.1.2

Weekly downloads
-
License
Apache-2.0
Repository
github
Last release
11 months ago

Souffle.js

Souffle.js offers bindings to Soufflé, an open-source, parallel logic programming language.

Installation

Install the library with Yarn:

yarn add @nowarp/souffle.js

Getting Started

Here is an example implementing the Simple Typed VarPointsTo example:

const ctx = new SouffleContext("VarPointsTo");

// Declare relations
ctx.add(
  relation("assign", [
    ["a", "Symbol"],
    ["b", "Symbol"],
  ]),
);

// Add facts
ctx.addFact("assign", ["v1", "v2"]);

// Define and output rules
ctx.add(
  relation(
    "alias",
    [
      ["a", "Symbol"],
      ["b", "Symbol"],
    ],
    "output",
  ),
);
ctx.add(rule([atom("alias", ["X", "X"])], [body(atom("assign", ["X", "_"]))]));

// Execute the Soufflé program
const executor = new SouffleSyncExecutor();
const out = executor.execute(ctx);
console.log("Raw Soufflé output:\n", out.results);

For the full example, see the source here.

Projects Using Souffle.js

0.1.2

11 months ago

0.1.1

11 months ago