4 ms·
Thank you so much for the book, please, continue! I am currently working on Scheme R5RS implementation in Java. It is a hobby project, but I'm really enjoying
by kovrik 10y ago
Thank you so much for the book, please, continue!
I am currently working on Scheme R5RS implementation in Java. It is a hobby project, but I'm really enjoying it. It is somewhat enlightening.
Look forward to reading the Optimization chapter: I couldn't find much useful and practical info on that. I think it is quite easy to implement your interpreter, but it is really difficult (at least for me) to make it fast.
Can anyone recommend any articles or books with common optimization tricks and techniques?
- agumonkey 10y agoI'm trying to bootstrap a forth and a scheme but i'm still at the thinking phase right now.
- ioddly 10y agoFor making an efficient Scheme implementation: most everything written by R. Kent Dybvig or his students. I'd start with his PHd thesis (Three Implementation Models for Scheme, specifically the stack-based part). http://www.cs.indiana.edu/~dyb/ http://www.cs.indiana.edu/~dyb/ (See also Lua's upvalues for a way to optimize closure variable access that's a bit simpler than his display closures).
- munificent 10y ago> See also Lua's upvalues for a way to optimize closure variable access Yes! In fact, that's how the C version of the interpreter in my book implements closures. It's pretty brilliant. <3 those Lua folks.
- Flow 10y agoWill you cover anything about LuaJIT's "NaN-coding"? Or perhaps do you have a link about how it works?
- munificent 10y agoYes, we'll do NaN-tagged values in the last chapter on optimization.
- munificent 10y ago> Thank you so much for the book, please, continue! I will! > Look forward to reading the Optimization chapter: I couldn't find much useful and practical info on that. There's not too much depth in that particular chapter. The whole second part is really about implementing an interpreter (fairly) efficiently in C. As you probably know, you have to think about performance at every level—your object model, bytecode format, hash table implementation, etc. If you'd like a sneak peek, the code for the entire book is actually done already (!). You can see which snippets go into each chapter cloning the repo[1] then running: make chapters make c_chapters make diffs Then take a look in build/diffs. There are a ton of optimization tricks that are specific to Scheme and Lisps and a lot of literature behind them. Macros and eval make it a lot harder. It's pretty dense, but I liked "Lisp in Small Pieces" a lot. [1]: https://github.com/munificent/craftinginterpreters https://github.com/munificent/craftinginterpreters
- spdegabrielle 10y agoLisp In Small Pieces by Christian Queinnec
- sitkack 10y agoTake a look at Nils Holm's http://www.lulu.com/shop/nils-m-holm/lightweight-compiler-techniques/ebook/product-18695558.html http://www.lulu.com/shop/nils-m-holm/lightweight-compiler-te...