/jscl

A Lisp-to-Javascript compiler bootstrapped from Common Lisp

Primary LanguageCommon LispGNU General Public License v3.0GPL-3.0

JSCL

JSCL is a Common Lisp to Javascript compiler, which is bootstrapped from Common Lisp and executed from the browser.

Getting started

You can try a demo here. But if you want to hack JSCL, you will have to download the repository

git clone git@github.com:davazp/jscl.git

load jscl.lisp in your Lisp, and call the bootstrap function to compile the implementation itself:

(jscl:bootstrap)

It will generate a jscl.js file in the top of the source tree. Now you can open JSCL.html in your browser and use it.

Status

JSCL is and will be a subset of Common Lisp. Of course it is far from complete, but it supports partially most common special operators, functions and macros. In particular:

  • Multiple values
  • Explicit control tranfers (tagbody and go)
  • Static and dynamic non local exit (catch, throw; block, return-from).
  • Lexical and special variables. However, declare expressions are missing, but you can proclaim special variables.
  • Optional and keyword arguments
  • SETF places
  • Packages

The compiler is very verbose, some simple optimizations or minification could help to deal with it.

Most of the above features are incomplete. It is not so bad because so the compiler is not too heavy, but it would be great if we were just enough compliant to include a loop implementation, a format implementation, or even CLOS or non-CLOS OOP.

Feel free to hack it yourself