完整版英文文献及翻译计算机程序_第1页
完整版英文文献及翻译计算机程序_第2页
完整版英文文献及翻译计算机程序_第3页
完整版英文文献及翻译计算机程序_第4页
完整版英文文献及翻译计算机程序_第5页
已阅读5页,还剩4页未读 继续免费阅读

下载本文档

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

文档简介

1、姓名:刘峻霖班级:通信143班 学号:2021101108Computer Language and ProgrammingI. IntroductionProgramming 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. Simi lar to natural languages, such as English, programmi

2、ng languages have a vocabulary, grammar, and syntax. However, natural languages are not suited for programming 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 l

3、ogical structures, and the rules 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 partic

4、ular model of computer system. For instance, programming languages such as FORTRAN and COBOL were written to solve certain general types of programming problems FORTRAN for scientific applications, and COBOL for business applications. Although these languages were designed to address specific catego

5、ries of computer problems, they are highly portable, meaning that they maybe used to program many types of computers. Other languages, such as machine languages, are designed to be used by one specific model of computer system, or even by one specific computerin certain research applications. The mo

6、st commonly used progra mminglanguages 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.II. Language TypesProgramming languages can be classified as either low-level languages or high-level langua

7、ges. 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 t

8、ranslated 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 intermediatelanguages that are very close to machine languages and do not have the level of linguistic sophistication

9、exhibited by other high-level languages, but must still be translated into machine language.1. Machine LanguagesIn machine languages, instructions are written as sequences of 1s and 0s, called bits, that acomputer can understand directly. An instruction in machine language generally tells the comput

10、er four things: (1) where to find one or two numbers or simple pieces of data in themain 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

11、to find the next instruction to perform. 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 sequences of 1s and 0s. A ty

12、pical 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.2. High-Level LanguagesHigh-level languages are relatively sophisticated sets of statements utilizing word s and syntax from human language. They a

13、re 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. However, high-level languages must be translated into machine

14、language by another program called a compiler before a computer can understand them. For this reason, programs written in a high-level language may take longer to execute and use up more memory than programs written in an assembly language.3. Assembly LanguagesComputer programmers use assembly langu

15、ages to make machine-language programs easier to write. In an assembly language, 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 the storage register A to

16、the contents of storage register B might be written ADD B, A in a typical assembl ylanguage statement. 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 assemblylanguages

17、when it is important to minimize the time it takes to run a program, because the translation from assembly language to machine language 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 flo

18、w of individual characters to a printer.III. Classification of High-Level LanguagesHigh-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

19、 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 sequenceabo operneeded elsewhere in the program, a simple statement can be used to refer back to the proc

20、edure. 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

21、be general enough to be used in different situations. Functional languages treat procedures like mathematical functionshigher and more rigorous leveland allow them to be processed like any other data in a program. This allows a muchof program construction. Functional languages alsoby the user as the

22、allow variables symbols for datathat can be specified and changedprogramming byprogram is running to be givenvalues only once. This simplifiesexecution, since areducing the need to be concernedwith the exact order of statementused in a programkey parts of manyvariable does not have to be redeclared

23、_ or restated, each time it is statement. Many of the ideas from functional languages have become 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

24、grouped together into units called objects. Objects are further grouped into classes, which define the attributes objects must have. A simpleexample of a class is the class Book. Objects within this class might be No vel and Short Story. Objects also have certain functions associated with them, call

25、ed methods. The computer accesses an object through the use of one of the objectmethods. The methodperforms some action to the data in the object and returns this valueto the computer.Classes of objects can also be further grouped into hierarchies, in which objects of one class can inherit methods f

26、rom 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-thenrules, which specify how one set of facts may be deduced from o

27、thers, 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.IV. Language Structure and Componen

28、ts 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 idea its purpose is to give the computer a basic instruction. Statements define the types of data allowed,

29、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). Statements known as data declarations give names and properties to ele

30、ments 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 the variables, how much numerical accuracy is to be used in the values, and h

31、ow one variable may represent a collection of simpler values in an organized fashion, such as a table or array. 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 s

32、ome other variable that is, they point to another variable. An expression is a piece of a statement that describe s a series of computations to be performed on some of the program' s variables,such as X+Y/Z, in which the variables are X, Y, and Z and the computations are addition and division. A

33、n assignment statement assigns a variable a value derived from some expression, while conditional statements specify expressions to be tested and then used to select which other statements should be executed next.Procedure and function statements define certain blocks of code as procedures or functi

34、ons that can then be returned to later in the program. These statements also define the kinds of variables and parameters the programmer can choose and the type of value that the code will return when an expression accesses the procedure or function. Many programming languages also permit mini trans

35、lation programs called macros. Macros translate segments of code that have been written in a language structure defined by the programmer into statements that the programming language understands.V. HistoryProgramming languages date back almost to the invention of the digital computer in the 1940s.

36、The first assembly languages emerged in the late 1950s with the introduction of commercial computers. The first procedural languages were developed in the late 1950s toearly 1960s: FORTRAN, created by John Backus, and then COBOL, created by Grace Hopper The first functional language was LISP, writte

37、n by John McCarthy4 in the late 1950s. Although heavily updated, all three languages are still widely used today. In the late1960s, the first object-oriented languages, such as SIMULA, emerged. Logic languages became well known in the mid 1970swith the introduction of PROLOG6, a language used to pro

38、gram artificial intelligence software. During the 1970s, procedural languages continued to develop with ALGOL, BASIC, PASCAL, C, and Ada SMALLTALK was a highly influential object-oriented language that led to the merging ofobject- oriented and procedural languages in C+ and more recently in JAVA10.

39、Although pure logic languages have declined in popularity, variations have become vitally important in the form of relational languages for modern databases, such as SQL.计算机程序一、引言计算机程序是指导计算机执行某个功能或功能组合的一套指令.要使指令得到执行,计算机必须执行程序,也就是说,计算机要读取程序,然后按准确的顺序实施程 序中编码的步骤,直至程序结束.一个程序可屡次执行,而且每次用户输给计算机的 选项和数据不同,就有

40、可能得到不同的结果.程序可分为两大类:应用程序和操作系统.应用程序直接为用户执行某项功能, 如字处理或玩游戏.操作系统治理计算机和与之相连的各种资源和设备,如随机访问 存储器、硬盘驱动器、监视器、键盘、打印机和调制解调器,以便使其他程序可以使 用它们.操作系统的例子包括:DOS、Windows 95、OS/2和UNIX .二、程序开发软件设计者通过特殊的应用程序来开发新程序,这些应用程序常被称作实用程序或开发程序.程序员使用称作文本编辑器的另一种程序,来以称作编程语言的特殊标 记编写新程序.使用文本编辑器,程序员创立一个文本文件,这个文本文件是一个有 序指令表,也称为程序源文件.构成程序源文件

41、的单个指令被称为源代码.在这个时 候,一种特殊的应用程序将源代码译成机器语言或目标代码一一操作系统将认作真程序并能够执行的一种格式.将源代码译成目标代码的应用程序有3种:编译器、解释器和汇编程序.这 3种应用程序在不同类型的编程语言上执行不同的操作,但是它们都起到将编程语言翻 译成机器语言的相同目的.编译器将使用FORTRAN、C和Pascal等高级编程语言编写的文本文件一次性从源代码译成目标代码.这不同于BASIC等解释执行的语言所采取的方式,在解释执行的语言中程序是随着每条指令的执行而逐个语句地译成目标代码的.解释执行的语言的优点是,它们可以立即开始执行程序,而不需要等到所有的源代码都得到

42、编译.对程序的更改也可以相当快地作出,而无需等到重新编译整个程序.解释执行的语言 的缺点是,它们执行起来慢,由于每次运行程序,都必须对整个程序一次一条指令地 译.另一方面,编译执行的语言只编译一次,因此计算机执行起来要比解释执行的 语言快得多.由于这个原因,编译执行的语言更常使用,而且在专业和科学领域几乎 总是得到采用.另一种译器是汇编程序,它被用于以汇编语言编写的程序或程序组成局部.汇编语言也是一种编程语言,但它比其他类型的高级语言更接近于机器语言.在汇编语 言中,一条语句通常可以译成机器语言的一条指令.今天,汇编语言很少用来编写 整个程序,而是最经常地采用于程序员需要直接限制计算机某个方面

43、功能的场合.程序经常被编写作一套较小的程序段,每段代表整个应用程序的某个方面.各段独立编译之后,一种被称为连接程序的程序将所有编译好的程序段组合成一个可以执 行的完整程序.程序很少有第一次能够正确运行的,所以一种被称为调试程序的程序常被用来帮助查找被称为程序错误的问题.调试程序通常在运行的程序中检测到一个事件,并向 程序员指出事件在程序代码中的起源.最近出现的编程系统,如Java,采取多种方法相结合的方式创立和执行程序.编译器取来 Java源程序,并将其译成中间形式.这样的中间程序随后通过因特网传送给计算机,而这些计算机里的解释程序接下来将中间程序作为应用程序来执行.三、程序元素大多数程序只是

44、由少数几种步骤构成,这些步骤在整个程序中在不同的上下文和以不同的组合方式屡次重复.最常见的步骤执行某种计算,然后根据程序员指定的顺序,进入程序的下一个步骤.程序经常需要屡次重复不长的一系列步骤,例如,浏览游戏得分表,从中找出最高得分.这种重复的代码序列称为循环.计算机所具有的使其如此有用的水平之一,就是它们能够作出条件判定,并根据正在处理的数据的值执行不同的指令.if-then-else 如果一那么一否那么语句通过测试某个数据段,然后根据结果从两个指令序列中选出一个,来执行这个功能.这些选择对象中的指令之一可能是一个goto语句,用以指引计算机从程序的另一个局部选择下一条指令.例如,一个程序可

45、能比较两个数,并依据比较的结果而分支到程序的另一 个局部:If x is greater than ythengoto instruction #10else continue程序经常不止一次地使用特定的一系列步骤.这样的一系列步骤可以组合成一个子例程,而子例程根据需要可在主程序的不同局部进行调用或访问.每次调用一个子 例程,计算机都会记住它自己在该调用发生时处在程序的那个位置,以便在运行完该 子例程后还能够回到那里.在每次调用之前,程序可以指定子例程使用不同的数据, 从而做到一个通用性很强的代码段只编写一次,而被以多种方式使用.大多数程序使用几种不同的子例程.其中最常用的是函数、过程、库程序、系统 程序以及设备驱动程序.函数是一种短子例程,用来计算某个值,如角的计算,而该 值计算机仅用一条根本指令无法计算.过程执行的是复杂一些

温馨提示

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

评论

0/150

提交评论