Skip to content

dogeMcdogeface/BacktraceToolsJS

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

en it

BacktraceToolsJS

A browser based PROLOG interpreter. Try the Live version

Table of Contents
  1. General Information
  2. Technologies Used
  3. Features
  4. Usage
  5. Setup
  6. Room for Improvement
  7. Acknowledgements
  8. Project Status
  9. Contacts

General Information

This tool is a self-contained interpreter for the Prolog programming language. It allows users to write and query Prolog programs, tabulate the results, and trace the steps taken to reach a solution, all from within a browser. Unlike other existing online interpreters, this tool is entirely client-based, which means that all queries are executed on the user's machine. This tool is built on top of a WebAssembly (WASM) port of SWI-Prolog, and is designed to provide a Graphical User Interface (GUI) for the language.

Technologies Used

Features

  • Real-time editing and querying of Prolog programs.
  • The code editors have all standard shortcuts, ctrl-z/y, ctrl-c/x/v ... Enter on queries executes them.
  • Code and queries are persistent across page reloads. A set of examples are available as well.
  • Automatic tabulation of results, with indication of whether more results are available.
  • Automatic tracing of the steps taken to reach each solution.
    • Display the steps taken in a graphical tree form.
    • Ability to zoom in and out of the tree.
    • Filter tree nodes based on the scope value.
    • Download trees as PNG or SVG.
  • Implement multi-threaded Prolog queries.

Usage

Simply open the editor in your browser, write your Prolog program, write your query, and press Enter.

alt text alt text

A set of examples is provided for testing both the functionality and limits of the tool.

alt text alt text

Users can select the number of solutions to compute, and abort the process if necessary.

alt text

For greater readability and more concise reading of the tree, users can select a reference scope to ignore nodes above a certain threshold.

alt text

It is even possible to download the graphic representation of the displayed tree in svg or png format.

alt text alt text

Setup

Only the www/ folder is required for the editor to work. A simple File Server in Java is included, but not required. Any other server may be used; The live version for example uses Github Pages with no additional configuration.

If you wish to recompile SWI-Prolog for the browser, please read the Wiki.

Room for Improvement

While the graphical interface of the tool is functional, its development has been largely independent of typical Prolog workflows. Feedback from experienced Prolog users would be appreciated to improve the tool's functionality and usability, especially in regards to conventional Prolog usages. This editor is not intended to compete with SWISH, nor does it offer a fraction of it's functions. However, the tool's ease of use and real-time local execution of queries might provide a convenient alternative for users who find SWISH cumbersome.

Acknowledgements

Give credit where due.

  • Many tanks to the individuals responsible for getting Prolog running in the browser, and for troubleshooting the many issues that came with it.

Project Status

Project is: in progress.

Contacts

Over here.