A programming language is more than just a means for instructing a computer to perform tasks. The language also serves as a framework within which we organize our ideas about computational processes. Programs serve to communicate those ideas among the members of a programming community. Thus, programs must be written for people to read, and only incidentally for machines to execute.
一种编程语言不仅仅是指示计算机执行任务的手段。语言也是一个框架,在这个框架内,我们在其中组织我们关于计算过程的想法。程序的作用是在一个编程社区的成员之间交流这些想法。因此,程序必须是写给人看的,而只是顺便给机器执行的。
When we describe a language, we should pay particular attention to the means that the language provides for combining simple ideas to form more complex ideas. Every powerful language has three such mechanisms:
当我们描述一种语言时,我们应该特别注意该语言提供为组合简单想法以形成更复杂想法的手段。每一种强大的语言都有三种这样的机制。
- primitive expressions and statements, which represent the simplest building blocks that the language provides,
- means of combination, by which compound elements are built from simpler ones, and
- means of abstraction, by which compound elements can be named and manipulated as units.
- 原始表达式和语句,代表了语言所提供的最简单的构件;
- 组合手段,通过这种手段从较简单的元素中构建复合元素;以及
- 抽象手段,通过这种手段,复合元素可以被命名并作为单位进行操作。
In programming, we deal with two kinds of elements: functions and data. (Soon we will discover that they are really not so distinct.) Informally, data is stuff that we want to manipulate, and functions describe the rules for manipulating the data. Thus, any powerful programming language should be able to describe primitive data and primitive functions, as well as have some methods for combining and abstracting both functions and data.
在编程中,我们要处理两种元素:函数和数据。(很快我们就会发现,它们其实并不那么明显。)非正式地讲,数据是我们想要操作的东西,而函数则描述了操作数据的规则。因此,任何强大的编程语言都应该能够描述原始数据和原始函数,并有一些方法来组合和抽象函数和数据。