Skip to content

w-henderson/WebPL

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

74 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

WebPL

A Prolog interpreter for the browser
Try Now »



WebPL is a web-native Prolog implementation, written from scratch in Rust and compiled to WebAssembly. Alongside the core interpreter, it also includes a simple web-based IDE for writing and running Prolog code in the browser, a precise garbage collector, and a JavaScript FFI for calling JavaScript functions from Prolog.

This project is the basis of my Cambridge Computer Science Tripos dissertation, written in the 2024-2025 academic year, and can be found here.

Installation

WebPL is available on NPM and can be installed with the following command:

npm install webpl

Usage

A basic usage example is shown below.

import init, { Solver } from "webpl";

async function main() {
  await init();
  const solver = await Solver.solve("is_even(X) :- 0 is X mod 2.", "is_even(4).");
  console.log(await solver.next());
}

About

🛠️ A Prolog interpreter for the browser.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published