-
Book Overview & Buying
-
Table Of Contents
Building Programming Language Interpreters
By :
The simplest use of a callable value is in a conditional operator, which needs to execute different branches and take them as arguments. Revisiting the operation tree in Figure 11.1, we get the following:

Figure 11.2: Operation tree with callable values
The dashed line in the diagram represents that the operation tree given to the operator that produces the callable is produced statically, just like it happens with the integral integers.
I will not list every code change here in the book, but before implementing the conditional, I also needed to introduce bool as a value type and introduce an equality operator. This change didn’t require any different techniques from what I did before. You can see the changes in pull request #9 (https://github.com/PacktPublishing/Building-Programming-Language-Interpreters/pull/9/files).
Considering that the operation tree is constant for the execution of the code, I will need to create a mechanism...