计算机英语课件学习.ppt_第1页
计算机英语课件学习.ppt_第2页
计算机英语课件学习.ppt_第3页
计算机英语课件学习.ppt_第4页
计算机英语课件学习.ppt_第5页
已阅读5页,还剩20页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

Computer English,Unit 3 Computer Language and programming (计算机语言与编程),. Introduction Programming languages, in computer science, are the artificial languages used to write a sequence of instructions (a computer program) that can be run by a computer. Similar to natural languages, such as English, programming languages have a vocabulary, grammar, and syntax. 计算机科学中的程序设计语言就是用于编写计算机可以运行的指令序列 (即计算机程序) 的人工语言。类似于诸如英语这样的自然语言,程序设计语言也有词汇、语法和语义。,Section A Programming Language (程序设计语言),However,natural languages are not suited for programming in computers because they are ambiguous, meaning that their vocabulary and grammatical structure may be interpreted in multiple ways. The languages used to program computers must have simple logical structures, and the rulers for their grammar, spelling, and punctuation must be precise.,然而,自然语言不适合于计算机的编程,因为它们很含糊,即它们的词汇和语法结构可用多种方式来解释。可用于计算机的编程的语言必须具有简单的逻辑结构, 并且它们的语法、拼写和标点规则必须很精确。,Programming languages vary greatly in their sophistication and in their degree of versatility . Some programming languages are written to address a particular kind of computing problem or for use on a particular model of computer system. For instance, programming languages such as FORTRAN and COBOL were written to solve certain general types of programming problemsFORTRAN for scientific applications, and COBOL for business applications.,各种程序设计语言的复杂度和通用性相差很大。有些程序设计语言是专为处理某种计算问题或专门用于某种特定模型的计算机上而编写的。例如,程序设计语言FORTRAN和COBOL 是专门为解决某类程序设计问题而编写的FORTRAN用于科学应用,COBOL用于商业应用。,Although these languages were designed to address specific categories of computer problems, they are highly portable, meaning that they may be used to program many types of computers. Other languages, such as machine language, are designed to be used by one specific model of computer system, or even by one specific computer in certain research applications. The most commonly used programming language are highly portable and can be used to effectively solve diverse types of computing problems. Languages like C, Pascal, and BASIC fall into this category.,尽管这些语言被设计用来处理特定类型的计算机问题,但它们的可移植性很强, 即可用于多种类型计算机的编程。其他语言,如机器语言,是设计用于某种特定模型的计算机系统上,甚至用于某些研究领域的某种计算机上。最常使用的程序设计语言的可移植性较高,并且可用于有效地解决多种类型的计算问题。像C、PASCAL和BASIC就属于这个范畴。,. Language Types (语言类型) Programming languages can be classified as either low-level languages or high-level languages. Low-level programming languages, or machine languages, are the most basic type of programming languages and can be understood directly by a computer. Machine languages differ depending on the manufacturer and model of computer. High-level languages are programming languages that must first be translated into a machine language before they can be understood and processed by a computer.,程序设计语言可以分为低级语言和高级语言。低级程序设计语言或机器语言是最基本的程序设计语言并且可被计算机直接懂得。机器语言因厂商和计算机模型的不同而相差很大。高级语言是那些在可被计算机懂得和处理之前必须首先被翻译成机器语言的语言。,Examples of high-level languages are C, C+, PASCAL, and FORTRAN. Assembly languages are intermediate level languages that are very close to machine language and do not have the level of linguistic sophistication exhibited by other high-level languages, but must still be translated into machine language.,高级程序设计语言的例子有C, C+, PASCAL和FORTRAN。汇编语言是接近机器语言的中级语言,并且不具有其他高级语言所表现出来的语言复杂性,但它仍然必须被翻译成机器语言(才能被计算机理解和执行)。,1. Machine Languages ( 机器语言) In machine languages, instructions are written as sequences of 1s and 0s, called bits, that a computer can understand directly. An instruction in machine language generally tells the computer four things: (1)where to find one or two numbers or simple pieces of data in the main computer memory ( Random Access Memory, or RAM), (2) a simple operation to perform, such as adding the two numbers together, (3)where in the main memory to put the result of this simple operation, and (4) where to find the next instruction to perform.,在机器语言中,指令被编写成1和0(称为位)的序列,计算机可直接懂得。机器语言的一条指令一般告诉计算机四件事:(1)从计算机主存(即随机存取存储器或RAM)的那个地方找到一个或两个数或一个简单的数据块;(2)去执行的一个简单操作,如把两个数加在一起;(3)在主存的什么地方放入这个简单操作的结果;(4)在什么地方找到下一条待执行的指令。,While all executable programs are eventually read by the computer in machine language, they are not all programmed in machine language. It is extremely difficult to program directly in machine language because the instructions are sequence of 1s and 0s. A typical instruction in a machine language might read 10010 1100 1011 and mean add the contents of storage register A to the contents of storage register B.,尽管所有可执行的程序最终都以机器语言形式被计算机读取,但并不是所有这些程序都是用机器语言编写的。因为机器语言指令都是0和1的序列, 要直接用机器语言来编程是很困难的。一条典型的机器语言指令可如10010 1100 1011所示, 它表示把存储寄存器A的内容加到存储寄存器B中。,2. High-level Languages (高级语言) High-level languages are relatively sophisticated sets of statements utilizing words and syntax from human language. They are more similar to normal human languages than assembly or machine languages and are therefore easier to use for writing complicated programs. These programming languages allow larger and more complicated programs to be developed faster.,高级语言是较为复杂的语句集合,这些语句利用人类语言中的词语和语义构成 。它们比起汇编语言或机器语言来更像正常的人类语言,因此更易于编写复杂的程序。这些程序设计语言使得大而复杂的程序开发起来更快。,3. Assembly Languages (汇编语言) Computer programmers use assembly languages to make machine-language programs easier to write, each statement corresponds roughly to one machine language instruction. An assembly language statement is composed with the aid of easy to remember commands. The command to add the contents of storage register A to the contents of storage register B might be ADD B, A in a typical assembly language statement.,计算机程序员使用汇编语言来使机器语言程序更容易编写,汇编语言的每一条指令粗略地对应于一条机器语言指令。一条汇编语言指令一般由有助于记忆命令的助记符组成。把存储寄存器A的内容加到存储寄存器B的内容上的命令可能是 ADD B, A 这样的典型汇编语言语句。,Assembly languages share certain features with machine languages. For instance, it is possible to manipulate specific bits in both assembly and machine languages. Programmers use assembly languages when it is important to minimize the time it takes to run a program, because the translation from assembly language to machine languages is relatively simple. Assembly languages are also used when some part of the computer has to be controlled directly, such as individual dots on a monitor or the flow of individual characters to a printer. 汇编语言与机器语言具有一些相同的性能,比如,在汇编语言与机器语言中都可以处理特定的位。当极小化程序运行时间很重要时程序员可以使用汇编语言,因为从汇编语言到机器语言的翻译相对简单。当计算机的某些部分需要直接控制时,也可以使用汇编语言,比如当显示器上的一个点或输往打印机的字符流需要直接控制时就可以使用汇编语言。,High-Level Languages are commonly classified as procedure-oriented, functional, object-oriented, or logic languages. The most common high-level languages today are procedure-oriented languages. In these languages, one or more related blocks of statements that perform some complete function are grouped together into a program module, or procedure, and given a name such as “procedure A.” If the same procedure is needed elsewhere in the program, a simple statement can be used to refer back to the procedure.,高级语言通常分为面向过程的语言、函数式的语言、面向对象的语言或逻辑语言。如今最常用的高级语言是面向过程的语言。在这些语言中,一个或多个相关的执行某种完整功能的语句块被组织成一个程序模块或过程,并被给予诸如“procedure A”这样的名字。如果程序中别的地方需要同一个过程,就可以用一个简单的语句来调用该过程。,. Classification of High-Level Languages (高级语言的分类),In essence, a procedure is just a mini-program. A large program can be constructed by grouping together procedures that perform different tasks. Procedural languages allow programs to be shorter and easier for the computer to read, but they require the programmer to design each procedure to be general enough to be used in different situations.,实质上, 一个过程就是一个小小的程序。可以将执行不同任务的过程组合起来构成一个大程序。过程语言允许程序简短和易于计算机阅读,但它们要求程序员将每个过程设计得足够一般化以至可用于不同的场合。,Functional languages treat procedures like mathematical functions and allow them to be processed like any other data in a program. This allows a much higher and more rigorous level of program construction. Functional languages also allow variablessymbols for data that can be specified and changed by the user as the program is runningto be given values only once.,函数式语言把过程当作数学函数来处理,并允许它们在程序中像其他数那样来处理。这就允许一种更高级和更严格意义上的程序设计。函数式语言还允许变量由用户定义并在程序运行过程中可改变的数据符号仅被赋值一次。,This simplifies programming by reducing the need to be concerned with the exact order of statement execution, since a variable does not have to be redeclared, or restated, each time it is used in a program statement. Many of the ideas from functional languages have become key parts of many modern procedural languages.,这就通过减少对语句确切执行顺序的关心简化了程序设计,因为一个变量每次用于某个语句时不需要重新定义或说明。函数式程序设计的许多思想已成为许多现代过程式语言的关键部分。,Object-oriented languages are outgrowths of functional languages. In object-oriented languages, the code used to write the program and the data processed by the program are grouped into units called objects. Objects are further grouped into classes , which define the attributes objects must have. A simple example of a class is the class Book. Objects within this class might be Novel and short story.,面向对象语言是函数式语言的发展结果。在面向对象语言中,用于编写程序的代码和程序处理的数据被组装成称为对象的单元。对象又被进一步分组成类, 类定义对象必须具有的属性。类的一个简单例子是“书”. 这个类中的对象可能是小说和短故事。,Objects also have certain functions associated with them, called methods. The computer accesses an object through the use of one of the objects methods. The method performs some action to the data in the object and returns this value to the computer. Classes of objects can also be further grouped into hierarchies, in which objects of one class can inherit methods from another class. The structure provided in object-oriented languages makes them very useful for complicated programming tasks.,对象也有一些与之相关的函数,称为方法。计算机就是通过对象的某个方法来访问对象的数据。该方法对对象中的数据执行某些操作活动,并将数值返回给计算机。对象类还可以组织成层次结构,其中一个类的对象可以继承另一个类的方法。面向对象语言中提供的这种结构使得它们对于复杂的程序设计任务特别有用。,Logic languages use logic as their mathematical base. A logic program consists of sets of facts and if-then rules, which specify how one set of facts may be deduced from others, for example: If the statement X is true, then the statement Y is false. In the execution of such a program, an input statement can be logically deduced from other statements in the program. Many artificial intelligence programs are written in such languages.,逻辑语言使用逻辑作为其数学基础。一个逻辑程序包含一些事实集和if-then规则,这些规则表示一个事实集如何从另一个事实集推得,例如:如果语句X为真,则语句Y为假。 在执行这样一个程序时,程序中一个输入语句可从另一个语句逻辑地推得。许多人工智能程序都用这种语言写成。,Programming languages use specific types of statements, or instructions, to provide functional structure to the program. A statement in a program is a basic sentence that expresses a simple ideaits purpose is to give the computer a basic instruction. Statements define the types of data allowed, how data are to be manipulated, and the ways that procedures and functions work. Programmers use statements to manipulate common components of programming languages, such as variables and macros (mini-programs within a program).,程序语言使用特定类型的语句或指令来为程序提供功能结构。程序中的一个语句就是表达一个简单意思的基本句子其目的就是给计算机发一个基本指令。程序语句定义了允许使用的数据类型、数据的处理方式以及过程和函数的工作方式。程序员使用语句来处理程序语言的常用成分,如变量和宏(程序中的小程序)。,. Language Structure and Components,Statements known as data declarations gives names and properties to elements of a program called variables. Variables can be assigned different values within the program. The properties variables can have are called types, and they include such things as what possible values might be saved in variables, how much numerical accuracy is to be used in the values, and how one variable may represent a collection of simpler values in an organized fashion, such as a table or array.,众知的数据声明给程序中称为变量的元素以名字和性质。变量在程序中可被赋予不同的值。变量可具有的性质称为类型,变量的性质包括诸如此类的东西:变量中可以存储什么样的值,这些值的数值精度大小如何以及一个变量如何以诸如表或数组这样的组织形式来表示一个简单的值集。,例如: int x, a10; 16位 -3276832767,In many programming languages, a key data type is a pointer. Variables that are pointers do not themselves have values; instead, they have information that the computer can use to locate some other variablethat is, they point to another variable.,在许多程序设计语言中,一种关键的数据类型是指针。指针类型的变量本身不具有值;相反,它们具有计算机可用于查找其他变量的信息,即它们指向另一个变量。,例如: int* iptr;,An expression is a piece of a statement that describes a series of computations to be performed on some of the programs variables, such as X+Y/Z, in which the variables are X, Y, and Z and the computations are additi

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论