by matthewtoast on 12/27/15, 12:29 PM with 3 comments
by matthewtoast on 12/27/15, 12:36 PM
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