Crafting Interpreters: Closures
craftinginterpreters.com
Crafting Interpreters: Closures
1–10 of 62 posts
Re: Crafting Interpreters: Closures
#2The writing is charming and approachable, while still packed with an impressive amount of knowledge.
Re: Crafting Interpreters: Closures
#3This is one of my favorite books(-in-progress) to follow along with. If you've ever even had a passing curiosity in how interpreters work, I highly recommend checking it out from the beginning: http://craftinginterpreters.com/welcome.html The writing is charming and approachable, while still packed with an impressive amount of knowledge.
Re: Crafting Interpreters: Closures
#4This is one of my favorite books(-in-progress) to follow along with. If you've ever even had a passing curiosity in how interpreters work, I highly recommend checking it out from the beginning: http://craftinginterpreters.com/welcome.html The writing is charming and approachable, while still packed with an impressive amount of knowledge.
Any more gems like this you would recommend?
[0] gameprogrammingpatterns.com
Re: Crafting Interpreters: Closures
#5This is one of my favorite books(-in-progress) to follow along with. If you've ever even had a passing curiosity in how interpreters work, I highly recommend checking it out from the beginning: http://craftinginterpreters.com/welcome.html The writing is charming and approachable, while still packed with an impressive amount of knowledge.
Any more gems like this you would recommend?
Also enjoyed Game programming patterns by Bob again, but that has already been mentioned.
Re: Crafting Interpreters: Closures
#6Instead of always heap-allocating variables that are used by closures, it starts by stack-allocating them and only moves them to the heap if the closure outlives its parent function. In order for this to work, the inner function always accesses the outer variables through an indirection (upvalue).
The main advantage of this approach is that it is compatible with a single-pass compiler, without sacrificing performance in the common case where closures are not present. Since the generated code for using a variable is the same no matter whether it is used by inner functions or not, the compiler can start emitting code as soon as it sees the variable declaration, without needing to look ahead to find where the variables are going to be used.
Re: Crafting Interpreters: Closures
#7This is one of my favorite books(-in-progress) to follow along with. If you've ever even had a passing curiosity in how interpreters work, I highly recommend checking it out from the beginning: http://craftinginterpreters.com/welcome.html The writing is charming and approachable, while still packed with an impressive amount of knowledge.
Any more gems like this you would recommend?
https://www.inf.ethz.ch/personal/wirth/CompilerConstruction/...
Modern Compiler Implementation in Java, C and ML.
https://www.cs.princeton.edu/~appel/modern/
From Nand to Tetris
Re: Crafting Interpreters: Closures
#8The implementation described here is inspired by Lua. Even if you already know what a closure is, it might still be a worthwile read, since it probably implements them very differently from what you are thinking! Instead of always heap-allocating variables that are used by closures, it starts by stack-allocating them and only moves them to the heap if the closure outlives its parent function. In order for this to wor…
That’s definitely not compatible with a single-pass though!
Re: Crafting Interpreters: Closures
#9This is one of my favorite books(-in-progress) to follow along with. If you've ever even had a passing curiosity in how interpreters work, I highly recommend checking it out from the beginning: http://craftinginterpreters.com/welcome.html The writing is charming and approachable, while still packed with an impressive amount of knowledge.
Any more gems like this you would recommend?
There's a follow-up as well: https://compilerbook.com/