Gay Lisp is open source and we need your help! Can you:

Check out the TODO for more ideas.

Gay Lisp

What is Lisp/Scheme?

Lisp is one of the oldest and most influential programming languages. Kind of like Latin is to European languages.

Scheme is a modern dialect of Lisp, renowned for its beauty but seldom used in the real world. Kind of like Italian.

What is Gay Lisp?

An interpreter for R5RS Scheme that runs in the browser, no plugins or downloads required. You can also run it on a server, using Node.

What do I need to run Gay Lisp?

If you are reading this, Gay Lisp is probably running on your device.

Gay Lisp is written in an unfancy version of JavaScript that has been included in browsers for more than a decade, so it should work in most browsers as long as JavaScript is not disabled.

This website, however, uses some more recent bells and whistles, so an up-to-date browser is recommended.

How does it work?

There is a regex-based scanner and a recursive descent parser, both handwritten.

Programs are incrementally transformed into continuation-passing style and evaluated on a trampoline.

Primitive Scheme values are implemented by their primitive JavaScript counterparts as much as practical; in particular, the semantics of numerical operations are mostly those of JavaScript, while still complying with the Scheme standard.

All the non-primitive syntax and procedures are written in Scheme and loaded at boot time.

Really the first?

Yes. Gay Lisp is the first standards-compliant Scheme that runs in the browser.

Most JavaScript Scheme implementations provide a useful subset of Scheme without aiming for compliance with any standard. Typically, this means standard features that significantly complicate the implementation are omittted:

By contrast, Gay Lisp aims for complete compliance with R5RS. You can jump between the specification and the implementation in order to test features. And you can run every example in the specification straight from the specification.

Why R5RS instead of R6RS?

As of early 2012, work on future Scheme standards has split in two. One of these standards could abrogate features introduced by R6RS.

Is this useful for anything?

There is some experimental DOM interoperability:

((window 'alert) "hello from Scheme!")
"hello from Scheme!"

A medium-term goal is to replace the interpreter with a JavaScript code generator. When this is done, Scheme will be able to be included in HTML pages in the same manner as CoffeeScript.


[Channeling George Mallory and George Costanza] Because it's there.

I don’t get the pun.

The penis oo===D is bound to Turing’s normal-order Y combinator. It allows useful things like

(define g (lambda (f) (lambda (n) (if (= n 0) 1 (* n ((force f) (- n 1))))))) ((oo===D g) 10)

This combinator is usually provided in an applicative-order variant in other languages, but Scheme’s macro facility allows the normal-order definition.