RacketCon 2011 talk on Whalesong

The following is a rough sketch of the RacketCon 2011 talk I gave about Whalesong, a Racket to JavaScript compiler.

The slides themselves are a Whalesong-compiled world program: talk.html. Press Left and Right to advance the slides. Press Up, Down, Q, or W for additional fun. Press R for reset.


Slide 1

What's Whalesong? It's an upcoming Racket to JavaScript compiler. Whalesong will be used to support World programming for the web. It will be the evaluator for the upcoming versions of Moby Scheme, as well as for the WeScheme online programming environment.

I'm focusing on supporting World programs because of their role in the Bootstrap project, which aims to help middle schoolers connect algebra to something inherently interesting and useful: animations and video games.

Slide 2

We can support simple World animations, as you'd expect: (Show a world program: the falling rain drops program.) rain.html rain.rkt source

And we can do interactive games as well: (Show another world program: pacman.) pacman.html pacman.rkt source Press Up, Down, Left, Right for control. At the end of the game, the final world value will be displayed.

Slide 3

A core idea behind Whalesong is to reuse Racket's infrastructure as much as possible. I'm not a compiler person, so I cheat, by piggibacking on Matthew's work. Whalesong reuses the bytecode compiler, and translates the bytecode to JavaScript.

I really am reusing the linguistic features of Racket. For example, let's look at the less-than-impressive program output below. (Show the hello world program) hello.html

This is trivial, right? Now let's look at the source code. hello.rkt (Reveal that the program was written in brainf*ck)

Yes, this is unholy, but it works. We really are using Racket's underlying language features to handle reading, macro expansion, and optimization.

Slide 4

Because we're on the web, we may even want to use functions that we've written in Racket as a part of regular web pages. Whalesong lets us do this.

(Show the factorial example, and how it can be used by external JavaScript on a web page. Use view-source to show the index.html

Slide 5

There's quite a bit that's missing: we don't yet have all of the primitives necessary to compile racket/base, so all Whalesong programs currently have to be in a language that ultimately bottoms to (planet dyoo/whalesong/lang/base).

I'm going to get a release out in the following month, and the new versions of Moby Scheme for Smartphones, as well as the WeScheme environment, will be using the underlying evaluator of Whalesong.

If you're interested, please talk to me during the break. Thanks!