Closed ElessarDunadan closed 3 years ago
Machine code is not really different from a register based VM, it's just somewhat harder to encode (esp. for x86) and lower-level (depends on the VM we're comparing to).
The last chapter does suggest:
I like Cooper and Torczon’s “Engineering a Compiler” for this. Appel’s “Modern Compiler Implementation” is also well regarded.
That's probably about all I can do to get people moving in the right direction. I think me actually explaining how to compile all the way to machine code would a whole other book. :)
As someone approaching writing an interpreter for the first time, though I have now worked through the entire "book", it's still unclear how to free the code from the stack: My code->Lox interpreter->C->Machine code
I would love to see in section 30.4 some recommended resources and/or advice to move towards: My code->Lox interpreter->Machine code
This book does a good job of explaining how to write a VM, but has left me without understanding how to skip a VM entirely. Perhaps I missed something, but that's been my experience.
I realize that there are many in the community could explain this to me. However, since this book is targeted towards those who want to learn these things, I believe that it would be a great asset to those who, like me, would like a small push further in the direction of the above concepts.