-
Book Overview & Buying
-
Table Of Contents
Building Programming Language Interpreters
By :
So far, all the examples have been created with the goal of just exercising the code written until this point. Now, we’re finally at the point where we can create a scenario that will actually reflect how the user of the interpreter will actually interact with it.
There are several things that every user of this interpreter will have to do; therefore, it makes sense to introduce some infrastructure to manage those operations. I will begin with some underlying support types that will be needed when dealing with multiple threads.
The first one is MutexLockQueue. It provides a thread-safe queue to be used in order to communicate between threads. This is important so we can send data in sequence, such as for reads and writes, between the thread handling the I/O and the one handling the interpreter.
The second is NotificationSignal, which wraps a condition variable, allowing different threads to block waiting for other threads, such as when...