[gambit-list] Compiling Gambit Scheme to JavaScript

mikel evins mevins at me.com
Tue Mar 13 11:17:53 EDT 2012


On Mar 13, 2012, at 10:10 AM, Marc Feeley wrote:

> I was inspired by the ClojureScript project, a Clojure to JavaScript compiler, to look into the feasibility of a JavaScript back-end for Gambit.  A JavaScript back-end would allow running Gambit programs in web browsers.  Moreover, Scheme objects, including closures and continuations, could be sent between a Gambit Scheme program running on the browser and a Gambit Scheme program running on the server.
> 
> I did a fairly direct translation of the GVM code for the fib function into JavaScript (see the code attached below which interleaves the GVM code and JavaScript code).  Under V8 on a recent Mac Book Pro, this JavaScript program runs about 10 times slower than when the Scheme program is compiled with the C back-end (and 4 times faster than when the Scheme program is interpreted with gsi).  This is not so bad considering that JavaScript is a dynamic language with more overhead than C.  Moreover, for event-driven programs, which are most of the time waiting for input, this is probably an acceptable level of performance.
> 
> If anyone would like to pursue this idea, please let me know.

Marc,

As you may remember, I have a compiler/interpreter project of my own in the works. Bard is basically a response to my long-term pining for circa-1992 Dylan ( was part of the Apple team that wrote an OS for Newton in Dylan), plus my more recent affection for functional languages like Haskell.

Our Monday demo of Nelson went well. We are now working very hard to try to make the Thursday demo go even better, in hopes of securing the next round of contracts to build these educational games.

That next round of contracts involves promises that we hope to fulfill, in part, by completing a working Bard interpreter. The idea is that the in-game puzzle-description interpreter will be a Bard interpreter.

My ambitions for Bard extend beyond our games, though. For one thing, I'd like to turn it into a decent language for writing web apps. If bard is implemented in Gambit, and Gambit compiles to Javascript, then it seems to me like making a good Bard webapp framework gets a lot easier.

I don't know any specifics of how we might help each other, and don't have the cognitive bandwidth to think about it until after Thursday, but my intuition is that there's something useful we might be able to do for one another's projects. (At the very least, if we get enough funding we might be able to pay you  or perhaps your students to help in our tooling effort).

Again, no mnetal bandwidth for this right now, but let's talk later.

--me

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.iro.umontreal.ca/pipermail/gambit-list/attachments/20120313/a59c11e9/attachment.htm>


More information about the Gambit-list mailing list