1.0.16 • Published 6 years ago

lps v1.0.16

Weekly downloads
18
License
BSD-3-Clause
Repository
github
Last release
6 years ago

lps.js

Build Status

LPS is a logic-based programming language and production system developed by Robert Kowalski and Fariba Sadri at Imperial College London. lps.js is the LPS runtime implemented in JavaScript.

Usage

As CLI tools

lps.js provides several CLI tools to run and interact with LPS programs. For instructions on installation and how to use these CLI tools, see the lps-cli repository.

As npm Library

To use lps.js as a npm library, you need to have a package.json ready for your application (see npm documentation), then run the following command:

$ npm install --save lps

Once installed, you may access lps.js in your JS code by require() or import.

const LPS = require('lps');
LPS.loadFile('program.lps')
  .then((engine) => {
      engine.run();
  });

As Library in Browser Context

If you are using Webpack for bundling your client-side application, you can use lps.js as a normal Node.js library via require() or import. Webpack will automatically bundle lps.js into your client-side application.

Alternatively if you are not using Webpack, you may download a pre-bundled lps.js from Releases and use a <script> tag to include lps.js as a library in your web pages. If you wish, you may choose to create the bundled for browser lps.js yourself by following instructions below.

Once added to your web pages, the LPS object becomes globally accessible for use.

Bundling for Browser

To bundle lps.js for the browser, you need to have npm installed on your system, and also to install all development dependencies described in package.json by running npm install. Once all development dependencies are installed, you can create a bundled version of lps.js for the browser by running:

$ npm run build:browser

The output bundle JS file will then be found at dist/lps.bundle.js.

In LPS Studio

In addition to the other methods of running LPS programs, it is possible to write visualisation for LPS programs in LPS Studio. See the other repository for more information on how to download, run and write LPS visualisation in LPS Studio.

Tests

To run all tests on lps.js, you you need to have npm installed on your system, and also to install all development dependencies described in package.json by running npm install. Once all development dependencies are installed, start full tests by running:

$ npm test

To only test the source code using the unit test suite, you may use the command:

$ npm run test:source

Alternatively if you only wish to run tests on lps.js using LPS programs, you may use the command:

$ npm run test:programs

License

The lps.js implementation is open source and licensed under the BSD 3-Clause. The implementation is based on research and Prolog implementation authored by Robert Kowalski, Fariba Sadri, Miguel Calejo and Jacinto Dávila. The implementation of lps.js has also referenced David Wei's LPS implementation for his MSc Computer Science Individual Project and thesis at Imperial College London, supervised by Fariba Sadri and Krysia Broda, in 2015.

lps.js was implemented as part of Sam Yong's MSc Computer Science Individual Project and thesis at Imperial College London in 2018.

Resources

1.0.18

6 years ago

1.0.16

6 years ago

1.0.15

6 years ago

1.0.14

6 years ago

1.0.13

6 years ago

1.0.12

6 years ago

1.0.11

6 years ago

1.0.10

6 years ago

1.0.9

6 years ago

1.0.8

6 years ago

1.0.7

6 years ago

1.0.6

6 years ago

1.0.5

6 years ago

1.0.4

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago

1.0.0-beta1

6 years ago