To build an interpreter, compiler, or translator for a programming language such as Cymbol, we’d need to verify that Cymbol programs used symbols (identifiers) properly. In this section, we’re going to build a Cymbol validator that checks the following conditions:
Variable references have corresponding definitions that are visible to them (in scope).
Function references have corresponding definitions (functions can appear in any order).
Variables are not used as functions.
Functions are not used as variables.
To check all these conditions, we have a bit of work to do, so this example is going to take a little bit longer than the others to absorb. But, our reward will be a great base from which to build ...