<-- Back to schedule

Hop, Skip, Jump: Implementing a concurrent interpreter with Promises

Project: Hopper

Grace is a relatively new programming language, developed to provide more options for educators introducing programming to students. We have built a non-blocking interpreter for Grace in JavaScript, using a Promise-like API to control asynchronous behaviour. The result is Hopper, an interpreter which can be used as a Node.js command-line tool or as a regular JavaScript library on either Node or the browser. The interpreter uses various techniques to avoid hanging the browser while it is executing, as well as preventing the stack from overflowing during task execution.

This talk will discuss the challenges posed by implementing Hopper. It will investigate the Promises/A+ specification and how our implementation cannot be fully compatible with the spec while providing all of the necessary functionality, and our various attempts at developing our own extensions on top of a compliant system. In particular, we will look at the combination of language features from Grace that require these various extensions, including synchronous APIs, exceptions, and ensuring that 'finally' blocks execute at the appropriate time, as well as demonstrating how easy it is to build concurrent methods for Grace in Hopper. It will also cover the layout of the interpreter and the issue of attempting to support both Node.js and browsers with the same codebase (even in the presence of the browserify tool). Finally, it will consider the challenge of achieving performance in such a setting, where constantly jumping out of execution and deferring to the event loop compounds the more general issue of optimising an interpreter for a dynamic language.

Timothy Jones

Tim is a PhD student at Victoria University involved in programming language design and type theory. He got his start in open-source and the PL world as a core contributor to the CoffeeScript project before becoming enamoured with Haskell, and now teaches advanced programming language concepts, has produced a few papers in the field, and occasionally writes in Agda. He also organises Pixel Jam, an annual 48-hour game jam in Wellington, during which he always builds novelty fishing simulators.

Tim has worked as part of the Grace language project over the last three years, contributing to its open-source implementation and spawning several smaller projects of his own. His most recent work has been on Hopper, a concurrent JavaScript interpreter.