Proscript with HTML builtins and an interactive debugger

Programming for web browsers is attractive. Such a program can be run by any one, any where, and everyone knows how to access it: Any one with access to a computer can load a web page and this runs whatever program is associated with that page. There is a sophisticated environment for making web pages easily available.

There are compromises that web programming demands. Everything must be run by a browser, the program has limited access to the host platform environment (e.g. the file system), different browsers on different platforms have different behaviors that the program must allow for, the browser execution environment relies primarily on HTTP for network communication, and the program must run in an environment of HTML, CSS, and Javascript or WebAssembly. The particular compromise I am interested in is the requirement to program using Javascript. There are many projects to support programming in other languages – I would like to use Prolog as my web browser language.

The goal of my version of the Proscript project is to be able to create complex web pages using Prolog and a very small amount of Javascript. This small amount of Javascript is due to limits inherent in the situation that require a minimal amount of Javascript to be used to get the Prolog environment set up. The original Proscript project was created by Matt Lilley. My fork of Matt Lilley’s project extensively modifies it.

Proscript is a WAM-based implementation of Prolog with HTML document builtins and a Procedure Box Control Flow interactive debugger. The debugger uses a JQuery terminal running a Proscript interpreter as an element of a web page. The debugger is implemented along the lines presented in the LogicForSystems-1 technical note.

There is an example use of Proscript to create a simple calculator here.

Extending the WAM for tracing

While working on a javascript-based Prolog implementation (Proscript) I realized it needed an interactive debugger. Since Proscript is implemented using the Warren Abstract Machine (WAM) creating the standard Prolog debugger is complicated. I was not able to find any information on how people have solved this problem aside from reading the source of other Prolog implementations (e.g. GNU Prolog, SWI-Prolog).

I have created a technical note that describes how to integrate interactive debugging in Prolog with the WAM. This is presented in a tutorial fashion inspired by Hassan Aït-Kaci’s “Warren’s abstract machine: a tutorial reconstruction.”

Extending the WAM for tracing

What is Science Fiction?

I am an avid fan of science fiction. I enjoy other works of fiction as well, but science fiction has always been my favorite. I just stumbled on a great piece about science-fiction-as-literature written by Joanna Russ in 1975: Towards an Aesthetic of Science Fiction

This is an academic piece and thus somewhat dry. Nonetheless it is worth the effort to read for those of us entranced by science fiction. Ms. Russ says “That science fiction, like much medieval literature, is didactic.” She extends the medieval literature analogy in various convincing ways.

Medieval literature is a startling choice for the most interesting analogy to science fiction among traditional forms of literature.

 

SPARCL – Sets and Partitioning Constraints in Logic.

My PhD research (completed in 1996) was to create the SPARCL programming language. The dissertation is Seeing the Logic of Programming With Sets. From the abstract:

This dissertation studies the hypothesis that visual logic programming based on sets with partitioning constraints provides a superior basis for exploratory program- ming languages. Our research program is to design and implement such a program- ming language with an integrated development environment, and to analyze this implementation.

The programming language we have created is named SPARCL (Sets and Partitioning Constraints in Logic). It has the four elements of the hypothesis: it is a visual language, it is a logic programming language, it relies entirely on sets to organize data (which implies that programs are organized using sets, since programs can be viewed as data in this language), and it supports partitioning constraints on the contents of sets. In developing this language, we invented new visual language representation techniques (the automatically laid out “smooth” hyperedge in two and three dimensions) and a new kind of unification for logic programming (the partitioned set unification algorithm).

The SPARCL language was implemented in Logic Programming Associate’s  (LPA) MacProlog32 on an Apple Macintosh. Unfortunately LPA stopped supporting MacProlog32. I started the XGP open source project to replace MacProlog32 so that I could continue SPARCL (and other projects). XGP almost succeeded…