... at tremendous cost to my sanity. I've later been told I may have inadvertently broken two of the seven seals.
... at tremendous cost to my sanity. I've later been told I may have inadvertently broken two of the seven seals.
Was considering what it would take to write a small ML that compiles to lua. "Almost certainly more than I'm willing to put in" was my tentative unresearched conclusion but this validates it a bit.
The lisp ones look solid and I love lisp, but for this specific thing a good type system would be most valuable.
1. Convert to continuation-passing style (or ANF)
2. Perform closure conversion
3. Hoisting nested functions/lambda lifting
4. Generate C! (and then write a runtime/GC).
Targeting lua should be much easier
Some resources I like:
- Andrew Kennedy's 2007 paper Compiling with Continuations, Continued [1]. This one is the most clear IMO
- Andrew Appel's Compiling with Continuations book (a bit outdated though... assembly code is for VAX)
- Matt Might's series [2]
- MLton's source and documentation [3]
[1] https://www.microsoft.com/en-us/research/wp-content/uploads/...