[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Compilation to JS

From: Ian Price
Subject: Compilation to JS
Date: Mon, 5 Jun 2017 17:11:35 +0100

Hello Everyone,

This summer I am following up on the work of two years ago to compile
Guile to JS. As some of you may remember from irc back then, I was
making good progress until personal circumstances intervened. This
year I intend to get it into shape where we can consider including it
in Guile.

You can read my GSOC Proposal at,
but a summary is in order. I was able to compile a large portion of
the CPS language (as it existed two years ago) to a Javascript
intermediate language, and some transformations, particularly
inlining, were performed to improve the readability of the Javascript
before emitting it. A boot.js script was written which implemented all
the necessary VM primitives in Javascript. The majority of boot-9 was
supported, and I had written, compiled (and with some manual tweaking
ran) a bunch of programs that handled a large range of what we would
expect from Guile, and could handle mutual recursion, keyword
arguments, case-lambda, continuations, etc. You can see some of the
programs that were compiled and their (very hideous js output) on my
site at (e.g. was the
output of

The main work that needs to be done
1. Move from the previous cps representation to the new cps soup
2. Complete porting boot-9 to js (in particular, the guile module
3. Cheney on the MTA to handle tail calls for browsers that do not
   support tail call optimisation.
4. An addition to (scripts) to allow compilation to js, bundling in
   the new boot.js and necessary libraries.

Initially I am working on (1), as this will allow me to take advantage
of the work from two years ago. In order to rebase on a current Guile,
I think as a stopgap measure it makes sense to bring back the the
original cps representation first, and then to change the compiler I
wrote to use the new representation afterwards. Once this has been
accomplished I will feel comfortable posting a link to let you all
play with the stuff from previous years.

I will likely then proceed in numerical order.

On a personal note, it's good to be back here, paying attention to the
Guile project after a hiatus.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]