Skip to content
/ l4-lp Public

Fully in-browser IDE and rule engine for L4 (a DSL for business rules), along with various language binding libraries

Notifications You must be signed in to change notification settings

smucclaw/l4-lp

Repository files navigation

l4-lp

Experiments with:

  • Using term rewriting via Meander to transpile a textual version of L4 constitutive rules and predicates into Prolog.
  • Using SWI-Prolog running on WASM and its interop with Javascript to evaluate the transpiled Prolog and generate execution traces.

For context, this evolved from an older pipeline involving logical-english-client which utilised Logical English to transpile L4 to Prolog and generate execution traces.

Dependencies

This project is developed with JDK LTS 21 and nodejs LTS 20.11.1.

Usage

Setup

  pnpm install

Running the demo

Currently, this project transpiles a sample L4 program to Prolog, and then evaluates it using SWI-Prolog (running in WASM), capturing stack traces as JS objects and transforming them back into Clojure forms.

  • Make sure to setup the project first.

  • Also, follow the instructions here to enable custom formatters in your browser (so that the Clojure data structures which are logged in the console are readable).

  • Run the following command to start a local dev server in the public directory:

      pnpm start
  • Go to http://localhost:8000 in your browser and check your console. You should see the output of the L4 → transpiler, and the stack trace obtained from SWI-Prolog.

  • If you edit and save a file, it will recompile the code and reload the browser to show the updated version.

Compile an optimised version of the library

Run the following command:

  pnpm build:prod

This compiles an optimised, production-ready version of the library to public/js/main.js.

About

Fully in-browser IDE and rule engine for L4 (a DSL for business rules), along with various language binding libraries

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published