3 ms·
It would allow using any language that runs on the Guile VM. Guile has a compiler tower model where you define languages and their path towards being lowered to
by davexunit 2y ago
It would allow using any language that runs on the Guile VM. Guile has a compiler tower model where you define languages and their path towards being lowered to bytecode. The main language, Scheme, lowers to the Tree-IL language (high-level intermediate representation), then to the CPS language (low-level IR), and finally to bytecode. Elisp lowers to Tree-IL, which means from there it takes the same path as Scheme does to reach bytecode, so it gets to benefit from all the performance optimizations happening in Tree-IL (like partial evaluation) and CPS (which are numerous, like common subexpression elimination, contification, dead code elimination, etc.) It's a pretty neat system where all these different languages can intermingle in a pleasing way.
- senkora 2y agoI know there was incomplete work done at some point on implementing JS for Guile: https://www.gnu.org/software/guile/manual/html_node/ECMAScript.html https://www.gnu.org/software/guile/manual/html_node/ECMAScri... My understanding is that this is very far from being usable. But I mention it here because I suspect that some people on HN would be interested in the possibility of eventually running JS inside of Emacs.
- davexunit 2y agoYeah I think that was something Andy Wingo added over a decade ago that hasn't seen much love since, but along with elisp it's another good example of the compiler tower. If you write a language frontend that lowers to Tree-IL then you get to ride the compiler train all the way to bytecode for free. I think that's pretty neat. Another interesting use-case for the compiler tower is writing a language that compiles a machine readable specification to another language. guile-xcb compiles XCB's XML spec to Scheme: https://github.com/mwitmer/guile-xcb/blob/master/language/xml-xcb/compile-scheme.scm https://github.com/mwitmer/guile-xcb/blob/master/language/xm...