SWISH is inspired by web-based tools such as JSFIDDLE in that it allows you to develop a program and then share it with others on the Web. However, lacking both debugger and profiler, SWISH is far from a full-fledged IDE for Prolog, and to avoid compromising the server it does not allow you to execute "dangerous" predicates such as predicates reading and writing files. It does however allow you to use predicates such as read/1
and write/1
but they will only read from and write to your web browser.
We intend to make SWISH useful in an educational setting. For example, if you are a teacher, you may want to tell your students to share with you the solutions to exercises by sending you a link to SWISH loaded with their solutions ready to run. There is still work to do before this is a good alternative to a local installation though.
When you click the First button, your goal will be allowed to execute on the server for 300 seconds before aborting and returning with a message stating that the time limit has been exceeded.
SWISH works fine recent versions of in Safari, Firefox, Chrome and Internet Explorer (tested IE 11).
SWISH can be added easily to any SWI-Prolog web application. For example, it is available as an extension pack for ClioPatria, the SWI-Prolog RDF framework. It can be added to ClioPatria using the command below, providing an alternative for SPARQL for exploring the database (requires SWI-Prolog 7.1.23 or later).
?- pack_install(swish).
SWISH is implemented as a set of jQuery plugins, using Bootstrap for menus, modal windows and various styling aspects and CodeMirror for editing the Prolog source and query. Queries are executed by sending both the source text (right editor) and query (bottom-left editor) to the server, which creates a Pengine (Prolog Engine) to execute the query.
Pengines have many other applications, such as supporting Prolog RPC (Remote Procedure Calls, which allows you to execute a query fully transparent, including backtracking, on a remote server. An interesting aspect is that they provide a generic query language on top of an arbitrary Prolog program that can be used from JavaScript. A demo is available
The source code for SWISH is available on GitHub.