Skip to content

m0n0chr0m3/rulespace

 
 

Repository files navigation

Rulespace: an incremental bottom-up rule engine

Rulespace is a framework for specifying and instantiating incremental bottom-up rule engines. It consists of the following main parts:

  • Rulespace model and specification language for expressing facts and rules
  • Compilation of rules and facts into an executable module (a JS constructor or ES module)
  • Instantiation of Rulespace modules into a Rulespace instance that accepts fact deltas

Installation (developer)

git clone --branch deno https://github.com/rulespace/common.git
git clone --branch deno https://github.com/rulespace/rulespace.git
cd rulespace
deno test

Overview

Specification of rules and facts

A Rulespace program--a set rules and facts--is expressed using the AST defined in rsp.js.

To facilitate the specification of rules and facts, and for testing and debugging purposes, this package also defines a surface syntax that is s-expression-based. First, str2sexp turns Rulespace syntax into s-expressions, and then sexp2rsp transforms these s-expressions into a Rulespace AST.

Compiling into executable JavaScript

A Rulespace AST can be compiled into a JavaScript constructor or module using function rsp2js. The resulting function or module exposes an interface that accepts fact deltas, i.e., the addition or removal of facts.

Creating Rulespace instances

An instantiation of a Rulespace constructor, or the import of a Rulespace module, results in a fresh Rulespace instance that incrementally updates itself with every fact delta it receives.

Examples

Check the examples directory.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%