-
Book Overview & Buying
-
Table Of Contents
Building Programming Language Interpreters
By :
It’s technically possible to always rewrite any control flow in terms of a stack machine. However, unless you have a specific technical reason to build your interpreter that way, it likely makes more sense to allow the control flow in the execution to be interrupted and moved around.One simple example of this would be in situations where you have a return statement deeply nested in several conditionals. It would be possible to reorganize the operations so that the execution always flows back through the stack machine, but it would likely be simpler to simply allow a “return” operation that interrupts the evaluation of the stack machine and simply unwinds a language stack frame directly.But return is just the simplest of the control flow interruptions that we see in most modern programming languages. Here are a few other cases: