[Programming Languages And Lambda calculi] Realistic language model 5.1 ISWIM expression

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
Insert picture description here

Reduced to a code of 1, although most languages ​​will be quite verbal about (sub1 λy.y). The problem does not stop sub1and λ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.
Insert picture description here

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-:
Insert picture description here

1 ┐ represents the integer 1. + Represents the addition operator. ↑ means exponentiation, etc. And, we define a very useful if0 macro:
Insert picture description here

The relationship between FV and _[_ ← _] is extended to the new syntax in an obvious way:

Insert picture description here

Guess you like

Origin blog.csdn.net/qq_35714301/article/details/113925618