@nowarp/souffle
TypeScript icon, indicating that this package has built-in type declarations

0.1.2 • Public • Published

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

Package Sidebar

Install

npm i @nowarp/souffle

Weekly Downloads

148

Version

0.1.2

License

Apache-2.0

Unpacked Size

96.7 kB

Total Files

43

Last publish

Collaborators

  • byakuren-hijiri