Book contents
- Frontmatter
- Contents
- To the Reader
- 1 The Basics of Interpretation
- 2 Lisp, 1, 2, … ω
- 3 Escape & Return: Continuations
- 4 Assignment and Side Effects
- 5 Denotational Semantics
- 6 Fast Interpretation
- 7 Compilation
- 8 Evaluation & Reflection
- 9 Macros: Their Use & Abuse
- 10 Compiling into C
- 11 Essence of an Object System
- Answers to Exercises
- Bibliography
- Index
6 - Fast Interpretation
Published online by Cambridge University Press: 05 June 2012
- Frontmatter
- Contents
- To the Reader
- 1 The Basics of Interpretation
- 2 Lisp, 1, 2, … ω
- 3 Escape & Return: Continuations
- 4 Assignment and Side Effects
- 5 Denotational Semantics
- 6 Fast Interpretation
- 7 Compilation
- 8 Evaluation & Reflection
- 9 Macros: Their Use & Abuse
- 10 Compiling into C
- 11 Essence of an Object System
- Answers to Exercises
- Bibliography
- Index
Summary
In the preceding chapter, there was a denotational interpreter that worked with extreme precision but remarkably slowly. This chapter analyzes the reasons for that slowness and offers a few new interpreters to correct that fault by pretreating programs. In short, we'll see a rudimentary compiler in this chapter. We'll successively analyze: the representation of lexical environments, the protocol for calling functions, and the reification of continuations. The pretreatment will identify and then eliminate computations that it judges static; it will produce a result that includes only those operations that it thinks necessary for execution. Specialized combinators are introduced for that purpose. They play the role of an intermediate language like a set of instructions for a hypothetical virtual machine.
The denotational interpreter of the preceding chapter culminated a series of interpreters leading to inexorably increasing precision. Now we'll have to correct that unbearable slowness. Still adhering to our technique of incremental modifications, particularly because the preceding denotational interpreter is the linguistic standard we have to conform to, we will present three successive interpreters, gradually relaxing some of the preliminary descriptive concerns for the benefit of the habits and customs of implementers.
A Fast Interpreter
To produce an efficient interpreter now, we'll assume that the implementation language contains a minimal number of concepts, notably, memory. We'll get rid of the one we added in Chapter 4 [see p. 111] since we added it just to explain the idea of memory.
- Type
- Chapter
- Information
- Lisp in Small Pieces , pp. 183 - 222Publisher: Cambridge University PressPrint publication year: 1996