A modern Lisp that compiles to JavaScript with first class interoperability.
Compiler goals
- Interoperability with all Javascript environments (Node, Deno, Bun, browser etc)
- First class REPL (currently against Deno runtime) with realtime syntax highlighting and readline capabilities
- First class compiler error messages
Language features
- First class functions
- Pattern matching
- Destructuring
- Threading
- Macros
Fennel inspired syntax
> (fn fib [n]
(if (< n 2)
n
(+ (fib (- n 1))
(fib (- n 2)))))
<fn fib>
> (fib 10)
55
Destructuring
> (fn pair->sum [[x y]]
"Returns the sum of two numbers in a vector."
(+ x y))
<fn pair->sum>
> (pair->sum [1 4])
5
Pattern matching
> (match [1 2 3]
[] "empty list"
[2] "a single two"
[_ _] "two items"
[1 _ 3] "one something three"
:else "unknown")
"one something three"
Macros
> (macro for [[index start end next] body]
`(do (var ,index ,start)
(while (!= ,index ,end)
(do ,body
(,next ,index)))))
<macro for>
> (for [i 0 10 inc]
(print (inc 1)))
1 2 3 4 5 6 7 8 9 10
First class interop with any JS runtime
> (-> (. Deno (readTextFileSync "README.md"))
(split-lines)
(get 2))
"A modern Lisp that compiles to JavaScript with first class interoperability."
Requires Go 1.22 and Deno as the compiler uses it as the default environment in which to run compiled code.
Linux
$ make install
Others
$ make build
$ mv rem $(SOME_PATH)
$ rem -h
Usage: rem [--out OUT] [--repl] [--run] [--debug] [PATH]
Positional arguments:
PATH path to the input file
Options:
--out OUT, -o OUT path of the output file
--repl start REPL
--run run the output (deno)
--debug print debug info
--help, -h display this help and exit