Execution Frames, the Stack, and Continuations
In the previous chapter, I started the process of implementing the interpreter’s stack machine. However, that implementation is not yet capable of handling control flow operations, such as conditionals or functions. In this chapter, I will add those capabilities, as well as discuss how the interpreter needs to manage the execution across multiple continuations.
More specifically, this chapter will work through the following:
- How an operation tree needs to be treated as a value in order to allow redirecting the execution
- The way in which the interpreter dynamically chooses what to invoke
- How a function is made by a sequence of operations, control flow, and variable scopes
- How the interpreter handles the calling of a function
- How to implement an end-to-end example of a function declaration and its invocation
By the end of this chapter, you will have a practical understanding of how...