Evaluation • Chapter 7 • Build Your Own Lisp

• Chapter 7 Now we can read input, and we have it structured internally, but we are still unable to evaluate it. In this chapter we add the code that evaluates this structure and actually performs the computations encoded within. This internal structure is what we saw printed out by the program in the previous chapter. It is called an Abstract Syntax Tree , and it represents the structure of the program based on the input entered by the user. At the leaves of this tree are numbers and operators - the actual data to be processed. At the branches are the rules used to produce this part of the tree - the information on how to traverse and evaluate it. Abstract Christmas Tree • A seasonal variation Before working out exactly how we are going to do this traversal, let's see exactly how this structure is defined internally. If we peek inside mpc.h we can have a look at the def...

Linked on 2014-12-03 04:38:18 | Similar Links