Chapter 3. More Expressions

Table of Contents

3.1. Variables
3.2. Functions
3.3. More on Error Handling
3.4. Assignment Statements
3.5. Multi-Character Tokens
3.6. White Space

Installment published 4 Aug 1988.

In the last installment, we examined the techniques used to parse and translate a general math expression. We ended up with a simple parser that could handle arbitrarily complex expressions, with two restrictions:

In this chapter , we'll get rid of those restrictions. We'll also extend what we've done to include assignment statements function calls and. Remember, though, that the second restriction was mainly self-imposed … a choice of convenience on our part, to make life easier and to let us concentrate on the fundamental concepts. As you'll see in a bit, it's an easy restriction to get rid of, so don't get too hung up about it. We'll use the trick when it serves us to do so, confident that we can discard it when we're ready to.