On Mon, Mar 22, 2010 at 6:11 PM, Ben Weaver ben@orangesoda.net wrote:
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.
Yep, that's exactly what I was thinking. It might require a little more than a lightweight macro layer, though. I would like to translate "return" statements into calls to continuations, and make sure the code flow is as expressive as javascript's. You are right in that there is little difficulty in mapping Javascript-like syntax to Scheme.
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.
Great! We should talk more about it soon. What do you think about lexers like SILex? Or maybe we can pull a Javascript parser from an existing library. It's tempting to try to write something from scratch though. I'll probably start doing some research over the next couple of weeks. (btw, I'll probably see you soon Ben in your office!)
- James