Skip to content

SWI-Prolog/tinker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

107a377 · Apr 1, 2025

History

61 Commits
Mar 26, 2025
Mar 13, 2025
Mar 1, 2025
Mar 13, 2025
Mar 1, 2025
Mar 1, 2025
Mar 31, 2025
Mar 13, 2025
Mar 13, 2025
Mar 31, 2025
Mar 14, 2025
Mar 14, 2025
Apr 1, 2025
Mar 24, 2025
Mar 30, 2025
Mar 30, 2025

Repository files navigation

SWI-Tinker: SWI-Prolog in your browser

Public demo at https://wasm.swi-prolog.org/wasm/tinker

This repository implements SWI-Tinker, a SWI-Prolog playground running in your browser based on SWI-Prolog compiled using Emscripten to WASM.

The current system is primarily a proof-of-concept. You are encouraged to help improving it. The TODO file in this repo gives a list of possible improvements.

Achieved functionality

  • Run SWI-Prolog in your browser
  • Basic REPL loop window
  • Basic editor support based on CodeMirror
  • Saves command history and programs to your browser local store
  • Allows uploading and downloading programs
  • Allows for loading (compiling) these programs as well a loading programs directly from the internet.
  • Load large programs quickly as .qlf files.
  • Support for a basic debugger using the common ?- trace, mygoal. command. Support for spy- and break-points.

Limitations and alternatives

SWI-Tinker is over 10 times slower than native SWI-Prolog on the same hardware. SWI-Tinker lacks many libraries bundled with the native version, either for reducing the size or because required primitives are lacking. It also lacks important features of SWI-Prolog such as multi threading and access to a lot of system resources. To get a list of available and not-available libraries, run

?- check_installation.

Some alternatives for running Prolog in your browser are:

  • SWISH provides a server-based alternative, i.e., your queries are executed on a server. The SWISH environment is much more evolved, providing notebooks, file storage including version control, file sharing, etc. SWISH supports a different set of features. Queries on SWISH are executed stateless and are limited by a sandbox.
  • Ciao playground provides a WASM based version of Ciao Prolog.
  • Tau Prolog provides a Prolog version completely written in JavaScript.

Acknowledgements

Raivo Laanemets did most of the ground work getting SWI-Prolog to run using WASM. Jesse Wright provides the npm package swipl-wasm. Torbjörn Lager created the first version of SWISH.

About

SWI-Tinker: a browser playground for SWI-Prolog

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published