Skip to content

manuel/edgelisp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

EdgeLisp is a Lisp for JavaScript.

There's no formal definition of the language at the moment, so your
best bet is to look at the Lisp files in the lisp/ and client/
directories.  EdgeLisp should feel familiar to Common Lisp programmers.

A REPL is online at:

   http://manuel.github.com/edgelisp/repl.html

This REPL runs a stable version of EdgeLisp that lags behind the
master branch.  For a REPL with the newest code see INSTALL.

Features
--------

* Class-based object system (DEFCLASS)
  (currently only single inheritance)

* Multiple-dispatching generic functions (DEFGENERIC, DEFMETHOD)
  (using Cecil-style symmetric method lookup)

* Separate function and variable namespaces (Lisp-2)
  DEFPARAMETER, DEFVAR, DEFUN, LET, LET*, FUNCALL, APPLY
  (FLET and LABELS currently missing)

* &OPTIONAL, &KEY, &REST, &AUX parameters
  as well as &ALL-KEYS receiving keyword args as dictionary

* Runtime type-checked function parameters and results (using same
  syntax as DEFMETHOD for parameters and -> arrow syntax for result)

* Basic control flow (IF, PROGN, LOOP, COND, CASE, ECASE),
  Nonlocal exits (BLOCK/RETURN-FROM, CATCH/THROW), UNWIND-PROTECT

* Condition system with restarts
  HANDLER-BIND, RESTART-BIND, SIGNAL, INVOKE-RESTART

* Numerical tower: real, rational, integer
  (small integers are represented as Number)

* Hygienic DEFMACRO (based on SRFI 72) with basic destructuring;
  #` and #' for hygienic code quotation, analogous to ` and '

* Slot access through (overridable) generic functions;
  slots may be defined outside classes, with DEFSLOT.

* (Slightly) Generalized references
  SETF (appends "-setter")

* Inline JavaScript, with escaping back into Lisp, (and back into JS...)
  using #{ ... JavaScript code ... #} reader syntax.

* Dynamically-scoped (fluid-bound, actually) variables
  DEFDYNAMIC, DYNAMIC, DYNAMIC-BIND

Features TBD
------------

* Multiple inheritance
* FLET, LABELS, TAGBODY, DESTRUCTURING-BIND, MACROLET
* CALL-NEXT-METHOD; before-, after-, around-methods
* Sequence protocol based on D's ranges
* Package system

Plan
----

* Implement missing features
* Documentation and better test suite
* Make faster, smaller

Compatibility
-------------

EdgeLisp is intended to compile to EMCAScript, 3rd Edition (JavaScript
1.5), but currently uses the nonstandard extensions __proto__ (for
inheritance) and function.caller (for debugging).

EdgeLisp is tested on Chrome 11, Firefox 4, and Opera 11.10.

Files
-----

The major files are runtime.js, compiler.js, and lisp/boot.lisp.

runtime.js (together with reader.js) provides basic support such as
object model, forms, multiple dispatch engine, and many built-in
functions.

compiler.js translates Lisp to JavaScript, and also evaluates Lisp
expressions at compile-time (DEFMACRO and EVAL-WHEN-COMPILE).

lisp/boot.lisp builds up the language from the special forms and
built-in functions.

License
-------

If you modify EdgeLisp, you must make the modified version available
to your users under the AGPL.  See file COPYING.

(Using EdgeLisp for your programs does not place them under the AGPL.
You are free to choose any license for your Lisp code.)

Thanks
------

* Chris Double for parsing expression grammar
  https://github.com/doublec/jsparse
* Douglas Crockford for JSON parser
  https://github.com/douglascrockford/JSON-js
* Danny Yoo for numerical tower
  https://github.com/dyoo/js-numbers