from Hacker News

Show HN: Runiq, a little Lisp-inspired language that runs on JavaScript

by matthewtoast on 12/27/15, 12:29 PM with 3 comments

  • by matthewtoast on 12/27/15, 12:36 PM

    Runiq is my attempt to tie together a few ideas from Lisp with some features of JavaScript inside an interpreted language. Syntax, flexibility, data-as-code DNA would come from Lisp, while a JS backing could give reach and a big module ecosystem.

    Runiq more or less does this translation:

        source: (hack (the) (planet!))
        ast: ["hack", ["the"], ["planet!"]]
        reduce order: "the" "planet!" -> "hack"
    
    Function tokens map to predefined CPS JavaScript functions:

        "hack": function(a,b,cb){...}, // add numbers
        "the": function(cb){...}, // return 1
        "planet!": function(cb){...}, // return 2
    
    Outputs produce new trees that eventually reduce to a value.

        -> ["hack", ["the"], ["planet!"]]
        -> ["hack", 1, 2]
        -> [3]
        -> 3
    
    Runiq is very much an experiment, and some design decisions I made have trade-offs (speed, for one). But Runiq could still find a niche somewhere between grown-up projects like Clojure(Script) and single-purpose languages like PuzzleScript, both of which I admire.
  • by ktt on 12/28/15, 6:58 PM