Processing Instructions
The basic idea behind executing instructions is called the fetch-decode-execute cycle. First, we load an instruction from code memory. Then, we decode the instruction to find the operation and operands. Finally, we execute the operation. Rinse and repeat. Ultimately the interpreter runs out of instructions in the main program, or it executes a halt instruction.
The nature of the processor depends on what the code looks like in code memory. At the one extreme lies Pattern 24, Syntax-Directed Interpreter where we directly execute the text of the source code. At the other extreme, just above machine code, lies the bytecode interpreters in Chapter 10, Building Bytecode Interpreters. Pattern 25, Tree-Based Interpreter ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access