Hi James,

On Mon, Mar 22, 2010 at 8:30 PM, James Long <longster@gmail.com> wrote:

Is anyone else interested in working on this?

I've kicking a similar idea around for a while; I'd like to help.

What I've been thinking of is basically a parser for a nearly-JS syntax that generated s-expressions targeting some lightweight macro layer.  Where JS and Scheme semantics or runtime environments diverged, it'd be fine to use Scheme's.  Instead of implementing a JS interpreter, it'd be a JS-like syntax for the Scheme interpreter.

For example:

function adder(n) {
    return function(a) {
        return n + a;
    }
}

Could be parsed into something like:

(function adder (n)
  (function #f (a)
    (+ n a)))

And with the aid of something like:

(define-macro (function name params . body)
  (if name
      `(define ,name (function #f ,params ,@body))
      `(lambda ,params ,@body)))

Get something like:

(define adder
  (lambda (n)
    (lambda (a)
      (+ n a ))))

If you've got something different in mind, I'd be up for helping anyway.  I think a JS syntax for Scheme is a great way to introduce people to Scheme that wouldn't be interested otherwise.

Thanks,

-Ben