Introduction

This book is an analytic study of programming languages. Our goal is to provide a deep, working understanding of the essential concepts of programming languages. These essentials have proved to be of enduring importance; they form a basis for understanding future developments in programming languages.

Most of these essentials relate to the semantics, or meaning, of program elements. Such meanings reflect how program elements are interpreted as the program executes. Programs called interpreters provide the most direct, executable expression of program semantics. They process a program by directly analyzing an abstract representation of the program text. We therefore choose interpreters as our primary vehicle for expressing the semantics of programming language elements.

The most interesting question about a program as object is, “What does it do?” The study of interpreters tells us this. Interpreters are critical because they reveal nuances of meaning, and are the direct path to more efficient compilation and to other kinds of program analyses.

Interpreters are also illustrative of a broad class of systems that transform information from one form to another based on syntax structure. Compilers, for example, transform programs into forms suitable for interpretation by hardware or virtual machines. Though general compilation techniques are beyond the scope of this book, we do develop several elementary pro- gram translation systems. These reflect forms of program analysis typical of compilation, such as control transformation, variable binding resolution, and type checking.

Contents

Inductive Sets of Data

Data Abstraction

Environments

Interface for Recursive Data Types

Defining Recursive Data Types

Language Specification

Language: LET

Store

Language: EREF

Language: IREF

Language: MUTABLE-PAIRS

Parameter-Passing Variations

Language: CALL-BY-REFERENCE

Lazy Evaluation