Software Design by Example in Python 25: A Virtual Machine

Posted

In the end, you return to the beginning. This book started by showing learners how to implement objects and classes as dictionaries. Chapter 25: A Virtual Machine shows how to build a VM and translate assembly code into binary instructions for it. I don’t try to explain how those instructions might be implemented in hardware, but I hope anyone who has stuck with me this far will come away from this chapter with a better understanding of how languages like Python work. For those who want to go deeper, there is always Nystrom’s excellent Crafting Interpreters.

Concept map for a virtual machine

Terms defined: Application Binary Interface, assembler, assembly code, bytecode, conditional jump, disassembler, instruction pointer, instruction set, label (of address in memory), op code, register (in hardware), virtual machine, word (of memory).

Cover of 'Software Design by Example'