Show HN: Dak – a Lisp-like language that transpiles to JavaScript (daklang.com)
Hi HN, author here. Happy to answer any questions.
I had an itch to make a lisp like language that was a thin layer on top JavaScript. Something that could leverage the thriving ecosystem that exists around JavaScript. It's brittle, hot off the oven.
Besides being a fan of parenthesis, I think macros fill in a gap that the JavaScript ecosystem today fills in with one-off compilers, bundler plugins and such. Macros can't do everything, but for example I think they have the potential to enable things like JSX, Solid and Svelte style libraries.
Take the tour to get a feel for what it can do and play with the live code in your browser!
23 comments
[ 1.9 ms ] story [ 65.4 ms ] threadMaybe you also want to consider comparing Dak to other attempts in this direction in order to help generate more interest in your work:
https://github.com/anko/eslisp/blob/master/doc/comparison-to...
https://github.com/squint-cljs/squint Which is a thin layer on top of JS
https://github.com/squint-cljs/cherry Which is closer to CLJS semantics and data structures but compiles to .mjs files without any advanced optimizations etc.
Besides those aspects, Dak is different than these two specifically in that it tries to provide something closer to a minimal 1-to-1 language feature mapping to JavaScript as the base, with a goal of having essentially no runtime.
The clean room implementation has downsides - Squint and Cherry can reuse Clojure tooling like clj-kondo etc, which Dak cannot. On the other hand Dak is small, the transpiler is under 2k lines as I write this. It can run on virtually any modern JavaScript runtime (all browsers, node, deno, bun etc).
It looks like a lisp for me with its “code is data” (homoiconic) bit and s expressions.
What even is a proper Lisp? http://steve-yegge.blogspot.com/2006/04/lisp-is-not-acceptab...
Anyway, back to the main point, thank you for the article. I'll try to play around with Dak later today and see if I can use it to do something fun. Play is better to learn something after all.
1: https://groups.google.com/g/comp.lang.lisp/c/Bj8Hx6mZEYI/m/6...
I'd intended to develop my own mini-lisp with the same syntax, but got sidetracked by other projects. Maybe someday I'll get back to it. (Currently, I'm deep in the weeds trying to learn how to write a dependent typed language that compiles to javascript.)
[0]: https://github.com/sctb/lumen [1]: https://github.com/jorgebucaran/hyperapp
0. https://github.com/daaku/dak/blob/main/packages/transpiler/s...
My fear taking this path is around performance. I've not done any profiling yet, and I'm hoping I don't regret taking this path when I get around to it.
What I feel is missing from Parenscript is runtime macro-expansion, hard to do without using JS to build the AST.
[0] https://parenscript.common-lisp.dev/
Regarding runtime macro-expansion - since Dak is written in JavaScript, it comes for free.