[Reprint] computer programming language

Computer programming language

HTTPS: // www.cnblogs.com/Kevin-Yang/p/11221332.html 

recent blog article Zhou Park not had time to look carefully. A closer look at the time and other working days.

 

 

 

For the expression of a set of languages ​​detailed instructions for the digital computer. When these instructions are in the form of a specific number of computer manufacturers called machine language, after the replacement process corresponding to a simple assembly language expression, or after the certain "higher-level" language translation, the instructions may be executed directly. Although there are many computer languages, but relatively few are widely used.

Machine and assembly language is a "low level", requiring the programmer to explicitly manage all computer data storage operation and special features. In contrast, high-level language programmers can prevent worry about these considerations, and provides programmers easier to write and sign read.

Language type

<!-- Low Level Language -->

Assembly language and machine language (Machine and assembly languages)

<!-- High Level Language -->

ALGOL (Algorithmic languages)

FORTRAN
ALGOL
LISP
C

Business Oriented Language (Business-oriented languages)

COBOL
SQL

Education-oriented language (Education-oriented languages)

BASIC
Pascal
Logo
Hypertalk

Object-oriented language (Object-oriented languages)

C++
Ada
Java
Visual Basic

Declarative language (Declarative languages)

Scripting language (Scripting languages)

Document formatting language (Document formatting languages)

TeX
PostScript
SGML

World Wide Web Language (World Wide Web display languages)

HTML
XML
Web scripting

Elements of programming languages ​​(Elements Of Programming)

Control structures
Data structures

 

Language type

Assembly language and machine language (Machine and assembly languages)

Operation of the digital machine language of a particular computer can directly execute code. Code string of 0 and 1, or binary digit ( "bit"), they are often converted to a hexadecimal (base 16) for human viewing and editing. Machine language instructions typically operate using a number of bits to represent, for example, an addition, a number of operands, or may be used to indicate the location of the next instruction. Machine language is difficult to read because, unlike the conventional mathematical notation or human language, and its code depending on your computer.

Assembly language is designed to be easily converted into machine language. Although it is possible to refer to by name rather than by its machine address data block, but not in assembly language to provide more complex way to organize complex information. As with machine language, assembly language requires detailed knowledge of the internal computer architecture. When these details are important, such as when the programmed computer to interact with input / output devices (printers, scanners, storage devices, etc.), it is useful.

ALGOL (Algorithmic languages)

Algorithmic language is intended to convey mathematical or symbolic computation. They can be represented by the symbol algebra similar mathematical, and allows the use of common operations subprogram reuse. They are the first high-level language.

FORTRAN
first important are algorithmic language FORTRAN (Formula Translation), the IBM team led by John Backus design in 1957. It is intended for scientific computing a real number, and they are organized as a set of one-dimensional or multidimensional arrays. Control structure which comprises a conditional IF statement, repeated cycles (a so-called DO loop) and allow non-sequential execution of program code GOTO statement. FORTRAN subroutine for making common mathematical operations become convenient and build their libraries.

FORTRAN is also intended to be converted to efficient machine language. It is an immediate success and continues to develop.

ALGOL
ALGOL (algorithmic language) in the period from 1958 to 1960, designed by the United States Commission and the European computer scientists for publishing algorithms and calculation. And LISP (described in the next section), like, ALGOL recursive subroutine - can call itself to solve the problem of over-ALGOL provides a symbolic programming language for describing the structure of Backus-Naur Form, Backus-Naur Form In some variations body become illustrate programming language syntax (grammar) of standard tools. ALGOL widely used in Europe for many years it is still the language of computer algorithms release. Many important languages such as Pascal and Ada (are described later), are its descendants. Cheng, will reduce its smaller similar problems. ALGOL introduced block structure, wherein the program block may contain data and instructions, and has a structure identical to the entire application. Block structure for constructing a powerful tool for large programs compact assembly.

LISP
LISP (list processing) by John McCarthy in 1960 developed in Massachusetts Institute of Technology (MIT), which built on the mathematical theory of recursive functions (functions which appear in its own definition). LISP program is a function to the data, rather than a series of program steps FORTRAN and the ALGOL. LISP uses a very simple representation, and wherein the operation of the operand list given in parentheses. For example, (+ a (* bc) ) representative of a + b * c. While this seems awkward, but this sign is suitable for your computer. LISP list structure used to represent data, and since the programs and data use the same structure, and therefore it is easy to LISP program on another run as a program data.

LISP become the universal language of artificial intelligence (AI) programming, partly due to AI LISP and cooperation work at MIT, partly able to "learn" AI programs can be written in LISP modify the program for the self. LISP dialect by a number of developments, such as Scheme and Common LISP.

C
C programming language was developed by AT & T's Dennis Ritchie and Brian Kernighan in 1972, for programming a computer operating system. It is built by a combination of data and programs with the ability to smaller units ALGOL considerable. It uses a compact representation that allows programmers to use the data and address values to operate. This capability is important in systems programming, C and assembly language shared computers can take advantage of all the features of the interior architecture. C and C ++ descendants still one of the most commonly used language.

Business Oriented Language (Business-Oriented languages)
COBOL
COBOL (common business oriented language) since its inception in 1959, has been widely used enterprise. Computer manufacturers and users Commission and the US government organization set up CODASYL (data systems and languages committee) to develop and supervise language standards in order to ensure its portability in different systems.

COBOL using English-like symbol novel at the time of introduction. Business computing operations and large amounts of data organization, COBOL record data structure is introduced for these tasks. The heterogeneous data record (e.g., name, ID number, age, and address) to a polymerization unit. This is in contrast with scientific language, in the language, the homogeneous arrays are common. It is an important example of recording data "block" into a single object, which are present in almost all modern languages. 

SQL
SQL (Structured Query Language) is a language specified database organization (record set) for. Organizations using SQL database called relational database, because SQL provides functions to query the database to find information belonging to a given relationship. For example, the query may be "find all records that contain last_name Smith and city New York is." Commercial database programs generally use a SQL-like query language.

Education-oriented language (Education-Oriented languages)
the BASIC
the BASIC (Beginner's purpose Symbolic Instruction Code) by John Kemeny and Thomas Kurtz in the mid-1960s at Dartmouth College design. It is designed for beginners, especially non-computer science students easy to learn and works well on a time-sharing computer with many users. It has a simple structure and data symbols, and is interpreted as: BASIC program line by line and executed the translation in the translation, which makes it easier to find programming errors.

It's also compact and simple to make an early PC BASIC popular language. It recently adopted many other forms of data and control structures of contemporary language, which makes it more powerful but less convenient for beginners.

Pascal

About 1970, Swiss Professor Niklaus Wirth designed Pascal for structured programming, emphasizing the use of methodically without GOTO statement is conditional and looping control structures situation. Although similar notation Pascal ALGOL, but it provides a data type definition for the ability to organize complex information, which is beyond the ALGOL and COBOL and FORTRAN function features. User-defined data types allow programmers to introduce the name of complex data, and language translation can check whether proper use before running the program.

In the late 1970s and 1980s, Pascal is one of the most widely used programming language of instruction. It can be used on almost all computers, and because of its familiarity, security and clarity, it is used in the production of software and education.

LOGO
signs originated in the 20th century the late 1960s, as a simplified dialect of LISP education; Seymour Papert and others use it to teach mathematics to children of school age thinking at MIT. It has a more traditional grammar than LISP, and "Turtle Graphics" feature, which is simply a computer-generated graphics. (The name comes from an early project for the preparation of a similar robot turtle.) Turtle graphics using a body-centered instruction, one of the objects on the screen to move through commands such as "left 90" and "forward", specified action relative to the current position and orientation of the object, rather than a fixed frame. Recursive routine together, this technology makes writing complex and attractive model easier.

HyperTalk
HyperTalk by Bill Atkinson for the design of Apple's Macintosh "programming the rest of us." Using simple English-like syntax, Hypertalk so that anyone can quickly text, graphics and audio combined into a "link stack", by clicking the mouse button on the standard procedures provided by the navigation. In the 1980s and early 1990s, Hypertalk especially popular educators in the classroom for multimedia presentations. Although Hypertalk object-oriented language with many features (described in the next section), but Apple did not develop it for other computer platforms and allow it to flagging; With Apple's market share declined in the 1990s, and a new cross-platform multimedia display such a way that Hypertalk almost obsolete (see the Web display language section).

Object-oriented language (Object-oriented languages)
object-oriented language to help manage the complexity of large programs. And a packed data operation on the object so that only the operation of publicly accessible, and hides the details of the internal data structures. By allowing the programmer to be considered separately for each part of the program, which makes large-scale information hiding programming easier. In addition, the object can be derived from a more general object "inherit" their capabilities. This makes it possible to define the object hierarchy specific object without repeating all the more general objects in the object.

Object-oriented programming language Simula began (1967), which adds a hidden information is ALGOL. Another object-oriented languages ​​is influential Smalltalk (1980), where a program is a set of objects interact by sending messages to each other.

++ C
C ++ language in AT & T developed by Bjarne Stroustrup in the mid-1980s, to extend the C language by adding objects while retaining the C program efficiency. It has been one of the most important educational and industrial programming languages. Many operating systems of most, such as Microsoft Corporation's Windows 98, are written in C ++.

Ada
Ada to Augusta Ada King (Augusta Ada King) is named after, she was Countess Lovelace, was a 19th century British inventor Charles Babbage's assistant, is sometimes referred to as a computer programmer. Ada language is the beginning of the 1980s for the US Department of Defense to develop a large-scale program. It is similar to the Pascal representation capabilities and operation data packaged into separate modules combined. Its first form of Ada 83 is not fully object-oriented, but then the Ada 95 provides the ability to objects and their hierarchical structure. While Ada is no longer authorized to work for the Department of Defense, but is still valid language engineering large projects.

Java
in the early 1990s, Java of Sun Microsystems, Inc. Design, as the World Wide Web (WWW) programming language. Although it is similar in appearance to C ++, but it is completely object-oriented. In particular, Java eliminating the lower-level functions, including the ability to manipulate data addresses, this function is neither desirable nor practical for the program distributed system. To be portable, Java programs on each computer platform Java Virtual Machine translation by a specific, then execute Java programs. In addition to adding interactivity to the Internet through a Web "applet", Java is also widely used in the preparation of small portable devices such as mobile phones.

Basic Visual
Visual Basic was developed by Microsoft to extend functionality by adding objects BASIC and "event-driven" programming: buttons, menus and other elements of the graphical user interface (GUI) of. Visual Basic can also be used to write small routines in other Microsoft software.

Declarative language (Declarative languages)

Declarative language, also known as non-procedural or very high level programming language, which (ideally) program specifies the operation to be performed rather than how to perform. In these languages, the difference between the norm and its realization is less than a procedural language program described so far. Two common declarative language is a logical and functional languages.

Logic programming language, which PROLOG (programmed logic) are the best known, will be referred to as a set of program logic (e.g., parents, grandparents, parents of a person). The language is similar to the SQL database language. Program is executed by "inference engine", the inference engine to answer queries by systematically searching to extrapolate these relationships will answer the query. PROLOG has been widely used in natural language processing and other AI programs.


Language function has a mathematical style. By applying a function to the program parameters to the constructor. Functional languages such as LISP, ML and Haskell, are used as language development, math automatic theorem proving and some commercial projects research tool.

 

Scripting language (Scripting languages)

Scripting languages ​​are sometimes called small languages. They are designed to solve a relatively small programming problems, these problems do not need the overhead of data declarations and the large-scale program is easy to manage other functions required. Scripting language for writing operating system utilities for file manipulation program for special purposes, and because they are easy to learn, sometimes for considerable program.


PERL (Practical Extraction and Report Language) is developed in the late 1980s, initially for the UNIX operating system. It is designed to have all the features of the early scripting language. PERL provides many ways to state the common operations, allowing the programmer using any convenient way. In the 1990s, it became a system programming tool, whether it is small or large utility prototype program. Other languages ​​discussed below together, it has become popular computer programming Web "server."

Document formatting language (Document formatting languages)
document formatting language organization designated print text and graphics. They are divided into several categories: text formatting symbols can provide the same function with a word processing program, a page description language interpreted by the printing equipment, the most common is the markup language used to describe the various parts of a document intended function.

TeX
TeX was developed during 1977-86, by Stanford University professor Donald Knuth (Donald Knuth) text formatting language used to improve the quality of his book of mathematical symbols. WYSIWYG different text formatting system ( "WYSIWYG") word processors, plain text formatting commands embedded in the document, and then interpreted by the command language processor to generate a formatted document displayed or printed. TeX italic text mark, e.g., {\ it it is iticicized} , and shown in italics.

TeX largely replaced the earlier text formatting language of its powerful and flexible feature allows experts to precisely control the font selection, layout tables, mathematical symbols and graphics in the document contains. It is often used with the help of "macro" package, which package defines a simple command for common operations, such as starting a new paragraph; LaTeX is a widely used package. TeX contains many standard "style sheets" for different types of documents, and these may be further adjusted by each user. There are a number of related programs such as BibTeX, bibliography management, and has all the usual bibliographic styles of style sheets, and a variety of letter language version of TeX.

PostScript

PostScript is a page description language, Incorporated developed by Adobe Systems earlier on the work of Xerox PARC (Palo Alto Research Center) in the 1980s. These documents describe the language can be interpreted by a personal computer to display on its screen or printer through a document or typesetting device microprocessor.

For example, PostScript commands can be in a variety of fonts and sizes of text precise positioning, the mathematical description of the drawn image, and specify the color or shade. PostScript suffix, also known as reverse Polish notation, where the name of the operation to follow its parameters. Thus, "30060020270 arc of travel" means: in the position (300, 600) at a drawing ( "stroke"), 270 degree arc, a radius of 20. Although PostScript can read and write by the programmer, but it is usually a text formatting program, word processor or graphics display generation tool.

PostScript success is attributed to its specifications in the public domain, and with a very high-resolution laser printer to match. It affects the print font development, manufacturers produce a variety of PostScript fonts.

SGML
SGML (Standard Generalized Markup Language) is a markup language defined by international standards; that is, it is a meta-language. Marked by the symbol mark called composition, these tags specified functions or how to display text. SGML emphasized descriptive tags, which may be labeled "<emphasis>". This mark indicates that the document feature, which can be interpreted as reverse video on the computer screen, a typewriter or typesetting underlined text in italics.

SGML is used to specify DTD (Document Type Definition). DTD by specifying the document element that must be present (for example, <Title>) to define a document, such as reports, and provides rules for the use of document elements, such as paragraphs may appear in the table entry in the table but may not appear in the paragraph in. Parser can mark text analysis to determine whether it meets the DTD. Another program can read the mark to prepare an index or translating documents into PostScript for printing. Another may generate large or audio-visual or hearing-impaired readers.

World Wide Web Language (World Wide Web Run the display languages)
HTML
Web is used to display the Internet to retrieve text, graphics and audio system on a computer monitor. Each unit is called to retrieve pages, these pages often contain allows retrieval of related pages "link." HTML (HTML) is a markup language for coding Web pages. It is in the 1980s CERN nuclear physics laboratory in Switzerland, designed by Tim Berners-Lee, is defined by SGML DTD. HTML markup tags specify document elements, such as headings, paragraphs and tables. They mark a document for computer programs (called a Web browser) display. The browser interprets the tag, displays the title, paragraphs and tables to fit the screen size and available fonts in the layout.

HTML document also contains anchors, these anchors are specified point to mark links to other web pages. Form an anchor for the <A HREF= "http://www.britannica.com"> EncyclopædiaBritannica </A>, which quoted string is a link to a URL (Universal Resource Locator) (Web "address)") and its contents behind the text is displayed in a Web browser, it underlined that it is a link to another page. Display may be formed by a plurality of single page URL content, of some other URL contain text and graphics.

XML
HTML is not allowed to define new text element; that is, it can not be extended. XML (Extensible Markup Language) is a simplified version of SGML for document published on the Web. As with SGML, XML DTD is used to define the meaning of the document type and tag them for use. Easy to parse XML using the convention, such as the document entity from the start and end tags tags, such as <BEGIN> ... </ BEGIN> . XML provides a hypertext link HTML more than a species, such as two-way links and documents linked to the sub-section.

Because the author can define a new tag, it must contain XML DTD also instruct a Web browser how to interpret their rules - how to display or entity ready to operate, such as how to generate e-mail and the like.

Web scripting
marked with HTML or XML web page is mainly static documents. Web scripting can add it to the page when readers use the information, or allow readers can enter information such as orders passed to the department's online business. CGI (Common Gateway Interface) provides a mechanism; it requests and responses between the reader's Web browser and a Web server pages. CGI component on the server that contains small programs called scripts, these programs get information from the browser system or to provide information for display. A simple script might ask the reader's name, the Internet address system to determine the use of the reader, and print greeting. Scripts can be written in any programming language, however, because they are usually simple text processing routines, so as scripting languages such as PERL is particularly suitable.

JavaScript

Another method is to use a Web scripting language designed executed by the browser. JavaScript is a language by Netscape Communications Corp. designs, it can be used with Microsoft and Netscape browsers. JavaScript is a simple language, and Java completely different. JavaScript programs can be embedded into a web page with an HTML tag <script language = "JavaScript"> the. After selecting the page, the browser will execute JavaScript commands that back marker. In order to accelerate dynamic (interactive) display page, JavaScript or XML is usually used in conjunction with other languages, in order to exchange information between the server and the client browser. In particular, XMLHttpRequest command enables asynchronous data requests from the server, without requiring a server to resend the entire Web page. This method of programming or "philosophy" called Ajax (Asynchronous JavaScript and XML).

VB Script is a subset of Visual Basic. It was originally developed for Microsoft Office suite of programs developed later for Web scripts. Its function is similar to JavaScript, it can be embedded in HTML in the same manner.

Behind the use scripting language for Web programming is a component programming ideas, where the program is through a combination of separate components that were previously written without any further processing of language structure. JavaScript and VB Script programs are designed to be attached to a component of the Web browser to control their displays information.

Programming language elements (Elements Of Programming)
Despite symbol differences, contemporary computer language programming offers many of the same structure. These include basic control structures and data structures. The former provides a means of expression algorithm, which provides a method for organizing information.
 
Control structures (Control structures)
program in the process of language, the most common recipe is similar, there is a list of ingredients and use them step by step instructions. Almost three basic control structure of each programming language are:

1. Order - mixing liquid ingredients, then adding the dry ingredients.
2. Conditional - If the tomatoes are fresh, then simmer them, but if canned, skip this step.
Iteration beat egg whites until soft peaks form.
Sequence is the default control structures; instructions executed one after another. For example, they can perform a series of arithmetic operations, assigning the result to a variable to find the quadratic ax2 + bx + c = 0 the roots. Conditions IF-THEN or IF-THEN-ELSE control structure allows the program execution to follow an alternative path. Iteration or cycle computer provides most of the functionality. They can repeat a series of steps as necessary, appropriate steps can be repeated very simple solutions to complex problems.

It may be combined with the control structures. Sequences may contain several cycles; circulation loop may comprise nested therein, or may comprise two branch condition and a loop sequence having more conditions. "Pseudocode" as used herein, the "*" indicates multiplication, "←" is used to assign values ​​to variables. The following program fragment using the IF-THEN structure to find a root of the quadratic equation, quadratic equation:


 Secondary official

Assume that a non-zero quadratic formula and discriminant (the portion of the inner square root sign) is not negative (in order to obtain the number of the solid). Check the condition of these assumptions:

  • IF a = 0 THEN
  • ROOT ← −c/b
  • ELSE
  • DISCRIMINANT ← b*b − 4*a*c
  • IF DISCRIMINANT ≥ 0 THEN
  • ROOT ← (−b + SQUARE_ROOT(DISCRIMINANT))/2*a
  • ENDIF
  • ENDIF

SQUARE_ROOT function is used in the above-described subroutine fragments (also referred to as a procedure, a subroutine or function) of example. Subroutine sauce recipe is like a given, and as part of many other recipes. Receiving an input subroutine (the required number), and produce a result (sauce). Commonly used routines usually located to provide language collection or library. Subroutine can call another subroutine in its definition, as shown in the following procedure (wherein ABS is the absolute value function). SQUARE_ROOT is achieved by using the WHILE (variable) cycle that generates a good approximation of the square root of a real number unless x is very small or very large. By declaring the subroutine to write their name, input and output data types:

  • FUNCTION SQUARE_ROOT(REAL x) RETURNS REAL
  • ROOT ← 1.0
  • WHILE ABS(ROOT*ROOT − x) ≥ 0.000001
  • AND WHILE ROOT ← (x/ROOT + ROOT)/2
  • RETURN ROOT

Subroutine may be problem into smaller, more manageable sub problems. Sometimes the problem can be reduced by the lesser of the original version of the sub-problems to solve the problem. In this case, the routine is called recursive subroutines, because it repeated calls to solve the problem by itself. For example, the mathematical function factorial (! N = n ∙ (n-1) ⋯ 1, i.e., the product of the first n integers 3 ∙ 2 ∙) recursive routines may be programmed to:

  • FUNCTION FACTORIAL(INTEGER n) RETURNS INTEGER
  • IF n = 0 THEN RETURN 1
  • ELSE RETURN n * FACTORIAL(n−1)

Recursive advantage is that it is usually a simple restatement of precisely defined to avoid the bookkeeping details iterative solutions.

In the machine language level, looping and conditional branch instruction is implemented, the branch instruction says "jump to" the new points program. High-level language in the "goto" statement expressing the same operation, but is rarely used because it makes difficult for people to follow the procedures of "process." Some languages ​​(such as Java and Ada) does not allow it.

Data structure (Data structures)
control algorithm structure of the organization, the organizational structure of the data information. In particular, the data structure specified data type, which operations may be performed on them, while eliminating the need for programmers to the trace memory address. The data structure comprises a simple integer, real, boolean value (true / false), and a character or a string. Structure to form the composite data by combining one or more data types.

The most important is an array of complex data structures, similar data collection and recording, heterogeneous collection. Array may represent a vector of numbers, strings or a list of the set of vectors (or mathematical matrix array of arrays). Record store employee information name, job title and salary. An array of records (e.g., employee table) is the set of elements, each element is heterogeneous. In contrast, the record may contain a vector, i.e. an array.

Recording component selected by name or field; e.g., E.SALARY E may represent a payroll record field. Array element indexed by its location, or select; A [10] is an element in the array A at position 10. Thus FOR loop (iteration determination) may be (FIRST TO LAST as in the following example) operable to summation thereof by the array element having an index of limitation:

  • FOR i ← FIRST TO LAST
  • SUM ← SUM + A[i]

And an array of records has a fixed size. Can grow structures are built using dynamic allocation, new storage can be provided as needed. These data structures having components, each component containing data and references to other components (in terms machine, their addresses). This structure has a self-referential recursive definition. For example, bintree (binary) is either empty or contains the root assembly with the left and right data bintree "children". Such bintree effective implementation of the information table. Them subroutines natural operation is recursive; the routine prints out all the elements of bintree (each of which is a root of the subtree):

  • PROCEDURE TRAVERSE(ROOT: BINTREE)
  • IF NOT(EMPTY(ROOT))
  • TRAVERSE(ROOT.LEFT)
  • PRINT ROOT.DATA
  • TRAVERSE(ROOT.RIGHT)
  • ENDIF

Abstract data type (ADT) is important for large-scale programming. They will pack data structures and operations on its hide internal details. For example, the ADT table for the insertion and users seek operation, while retaining the underlying structure (either an array or a list of binary tree) is not visible. In object-oriented languages, classes are the ADT, examples of which are the object. The following pseudocode example object-oriented ADT bintree and assumes the existence of "superclass" COMPARABLE, characterized by the presence of the data comparison operation (e.g. integer "<"). It defines a new ADT, TABLE, it hides its data representation and provides a suitable operating table. Such polymorphic element type is defined according to the parameters COMPARABLE class. It must specify any instance of this type, there is a class of employee data with (COMPARABLE statement must provide the means PERS_REC comparison operations to sort the records). Implementation details are omitted.

Guess you like

Origin www.cnblogs.com/jinanxiaolaohu/p/11222894.html