3 ms·
Stack code can be mapped to register code trivially if you impose some restrictions (each word has a static effect and both branches of a conditional have the s
by slavapestov 3y ago
Stack code can be mapped to register code trivially if you impose some restrictions (each word has a static effect and both branches of a conditional have the same effect). Then lowering to SSA form performs an “abstract interpretation” where evaluating a word pops SSA values from a “abstract stack”, creates an SSA node and pushes its output values on the stack.
- vanderZwan 3y agoI wouldn't say that sounds trivial exactl... > slavapestov ... ok, fair enough: it probably is trivial for you, lol. (For the uninitiated: Slava Pestov created Factor, a modern concatenatvie language which (IIRC) did a lot of innovative stuff regarding optimizations in that domain) [0] https://factorcode.org/slava/ https://factorcode.org/slava/
- carapace 3y agoHa! Whenever I work on compiling Joy code I have to fight the urge to just write Joy-in-Factor and lean on all that crunchy goodness. (I wrote Joypy (mentioned in TFA), now Thun (someone took Joypy on PyPI so I renamed it) which includes interpreters in C, Nim, OCaml, and Prolog. I made a few feints at compiling Joy so far, but it's just kid's play compared to Factor. "I am but an egg.")
- lenkite 3y agoHe was the author of the jEdit editor too.