[gambit-list] compiling javascript syntax to scheme
Ben Weaver
ben at orangesoda.net
Mon Mar 22 18:11:51 EDT 2010
Hi James,
On Mon, Mar 22, 2010 at 8:30 PM, James Long <longster at 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 , at body))
`(lambda ,params , at 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.iro.umontreal.ca/pipermail/gambit-list/attachments/20100322/408e8132/attachment.htm>
More information about the Gambit-list
mailing list