Show HN: Dak – a Lisp-like language that transpiles to JavaScript

  • Interesting, in the CLJS space we recently got two new libraries in this space:

    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.

  • Looks interesting. I hope to start using an s-expression based version of javascript after I get more familiar with the latter.

    Maybe 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...

  • I'm enjoying reading your transpiler[0], especially how well you use generator functions. Currently I'm building a similar language in a more opinionated object-oriented style, yet I still find yours inspiring.

    0. https://github.com/daaku/dak/blob/main/packages/transpiler/s...

  • Nice work. A few years ago, I made something similar out of lumen[0] by tweaking the reader to support clojure style literals. I used hyperapp[1] as a lightweight library for react/elm style applications with a hiccup-like syntax. The code ended up looking like

        (h 'div { class: 'main }
           (h 'div {} ....
    
    Where h is the raw function for hyperapp, not a macro.

    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

  • Maybe dumb question since I only have experience with a few lisps (Common Lisp, clojure and scheme) but why is this “lisp like” and not a “proper” lisp?

    It looks like a lisp for me with its “code is data” (homoiconic) bit and s expressions.

  • Really reminds me of Parenscript[0], which is a subset of Common Lisp that transpiles to JS with no runtime. It's basically a thin skin around JS and it feels more like writing JS with a Lisp syntax.

    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/

  • Neat. So in a single sentence, you could say "As Janet is to Clojure, Dak is to ClojureScript".

  • Hmm, name is a bit too close to another language - darklang

  • In Australian slang, to da(c)k someone is to pull their pants down to humiliate them.