Chapter 10Building Bytecode Interpreters

In the previous chapter, we explored interpreters that operate on high-level programs with little to no preprocessing before execution. Those interpreters are great for implementing DSLs because they are the fastest path to getting a language up and running. Their only drawback is run-time efficiency. If we really care about efficiency for a particular DSL or need to implement a more general programming language, those interpreters aren’t appropriate.

In this chapter, we’ll explore another category of interpreters that is much more efficient. Unfortunately, the efficiency comes at the cost of a more complicated implementation. In essence, we need a tool that translates the high-level source code down ...

Get Language Implementation Patterns now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.