3.1 Introduction
3.1 Introduction
1 Introduction
Chapter 3
Hide contents Chapter 3: Interpreting Computer Programs
3.4.1 A Scheme-Syntax
3.1.1 Programming Languages
Calculator
3.4.2 Expression Trees
3.4.3 Parsing Expressions Programming languages vary widely in their syntactic structures, features, and domain of
3.4.4 Calculator Evaluation application. Among general purpose programming languages, the constructs of function definition
and function application are pervasive. On the other hand, powerful languages exist that do not
include an object system, higher-order functions, assignment, or even control constructs such as
3.5 Interpreters for Languages while and for statements. As an example of a powerful language with a minimal set of features, we
with Abstraction will introduce the Scheme programming language. The subset of Scheme introduced in this text
does not allow mutable values at all.
3.5.1 Structure
3.5.2 Environments In this chapter, we study the design of interpreters and the computational processes that they create
3.5.3 Data as Programs when executing programs. The prospect of designing an interpreter for a general programming
language may seem daunting. After all, interpreters are programs that can carry out any possible
computation, depending on their input. However, many interpreters have an elegant common
structure: two mutually recursive functions. The first evaluates expressions in environments; the
second applies functions to arguments.
These functions are recursive in that they are defined in terms of each other: applying a function
requires evaluating the expressions in its body, while evaluating an expression may involve applying
one or more functions.
Continue: 3.2 Functional Programming
Composing Programs by John DeNero, based on the textbook Structure and Interpretation of Computer Programs by Harold Abelson and Gerald Jay Sussman, is licensed under a Creative
Commons Attribution-ShareAlike 3.0 Unported License.
https://www.composingprograms.com/pages/31-introduction.html 1/1