Inspired partly by BiwaScheme[0], I wrote an interpreter for Arc in coffee-script. It's on github, but no README yet. https://github.com/hasenj/jsarc It supports quasiquatation, special syntax (such as 'a.b!c, 'a:b~c), and macros. You can run a REPL by executing ./jsarc Here's a sample session jsarc> 'a
a
jsarc> 'a.b
a.b
jsarc> (ssexpand 'a.b)
(a b)
jsarc> '`(a b c ,d ,@e)
(quasiquote (a b c (unquote d) (unquote-splicing e)))
jsarc> ((fn (a b) (/ (+ a b) 2)) 10 20)
15
jsarc> (mac def (name args . body) `(= ,name (fn ,args ,@body)))
<macro>
jsarc> (def avg (x y) (/ (+ x y) 2))
<lambda>
jsarc> (avg 20 10)
15
jsarc> ((list 1 2 3 4 5 6) 4) # indexing
5
Needless to say, it's no where near usable yet. Only the very basics are implemented.I'm not too sure where this could go. Initially I wanted to see if I could make it so that I can write Node.js apps using Arc. I'm not too sure this is possible (since it's an interpreter, not a compiler). One problem is that Arc data types don't directly map to javascript types. [0] http://www.biwascheme.org/ |