Part II Realistic Language Model
Chapter 5 ISWIM
Church developed Lambda calculus as a complement to mechanical calculations and became a method of learning mathematics. In the 1960s, Landin proved that Church's Lambda calculus is not a suitable model for most programming languages. For example, Lambda expression
Reduced to a code of 1, although most languages will be quite verbal about (sub1 λy.y). The problem does not stop sub1
and λy.y encoding, the entire expression is β after about technology, (sub1 λy.y) parameters will be ignored completely.
Whether this feature of name calling is desirable remains to be discussed. In any case, many languages do not support name calling. Instead, they support value calls, which must fully evaluate the parameters of the function before applying the function.
In this chapter, we will introduce Landin's ISWIM , which will be closer to the core of value calling languages, such as Scheme and ML. The basic syntax of ISWIM is the same as Lambda calculus, and the concepts of free variables and sub-conditions are the same. But different from Lambda calculus, which is closer to the actual programming language, ISWIM comes with a set of basic constants and basic operations. The most fundamental difference lies in the value call reduction rule proposed by ISWIM.
5.1 ISWIM expression
The syntax of ISWIM extends Lambda calculus.
Among them, an expression (on M 1... M m) (o^n\ M_1\ ...\ M_m)( then M1 ... Mm) Only holds when n = m. We can be defined in many ways a collection of b and Othe n-; the advanced properties of the language will remain the same. Specifically, E b we will use the following definitions and On-:
┌ 1 ┐ represents the integer 1. + Represents the addition operator. ↑ means exponentiation, etc. And, we define a very useful if0 macro:
The relationship between FV and _[_ ← _] is extended to the new syntax in an obvious way: