Enough about data—how does Guile run code?
Code is a grammatical production of a language. Sometimes these languages are implemented using interpreters: programs that run along-side the program being interpreted, dynamically translating the high-level code to low-level code. Sometimes these languages are implemented using compilers: programs that translate high-level programs to equivalent low-level code, and pass on that low-level code to some other language implementation. Each of these languages can be thought to be virtual machines: they offer programs an abstract machine on which to run.
Guile implements a number of interpreters and compilers on different language levels. For example, there is an interpreter for the Scheme language that is itself implemented as a Scheme program compiled to a bytecode for a low-level virtual machine shipped with Guile. That virtual machine is implemented by both an interpreter—a C program that interprets the bytecodes—and a compiler—a C program that dynamically translates bytecode programs to native machine code36.
This section describes the language implemented by Guile’s bytecode virtual machine, as well as some examples of translations of Scheme programs to Guile’s VM.
|• Why a VM?|
|• VM Concepts|
|• Stack Layout|
|• Variables and the VM|
|• VM Programs|
|• Object File Format|
|• Instruction Set|
|• Just-In-Time Native Code|
Even the lowest-level machine code can be thought to be interpreted by the CPU, and indeed is often implemented by compiling machine instructions to “micro-operations”.