Python's basic knowledge of computer language--classification of programming languages

Source: Internet
Author: User

First, computer language classification

  Low-level language, high-level language, specialized language, scripting language

1, Low-level language : Machine language, assembly language and symbolic languages. Machine language is a kind of machine instruction (machine code) that can be directly recognized and executed by the computer by using the binary code, which is the computer's designer to give the computer's operation function through the computer's hardware structure; assembly language (also known as symbol language) replaces the operation code of the machine instruction with mnemonics, Assembly language source program must be compiled to generate the target file, and then execute.

2, High-level language : mainly relative to the language, it is closer to the natural language and mathematical formula programming, basically out of the machine hardware system, with people more easily understand the way to write programs, the program is called the source program. High-level language is not specific to a particular language, but includes many programming languages, such as popular Java,c/c++,c#,pascal,python,lisp,prolog,foxpro, easy language and so on.

3, Special language : CAD system of the drawing language and DBMS database query language.

4. scripting language : Also known as an extended language or dynamic language, used to control software applications, scripts are usually saved in text (such as ASCII) and interpreted or compiled only when called. Scripting language is a computer programming language that is created to shorten the traditional authoring-compiling-linking-running process. A script is usually interpreted as running rather than compiled. In many ways, high-level programming languages and scripting languages intersect, and there is no clear boundary between them. A script can automate the interaction that would otherwise be done with the keyboard.

Second, high-level language classification

  Compiled languages, interpreted languages, mixed languages

1, compiled language : Compiled language first "translates" The source code Generate the target code (machine language), and then run the machine code (binary) by the machine, its target program can be executed independently of its language environment. Compilation takes only one time, and later it does not need to be recompiled, so the compiled language executes efficiently. However, once the application needs to be modified, the source code must be modified before the new target file (*) is recompiled. OBJ) to execute only the target file without source code, modification is inconvenient. Compilation is done by the compiler. If we write the program code is contained in a source file, then usually compiled after the direct generation of an executable file, we can run directly. But for a more complex project, for ease of management, we usually distribute the code in various source files as different modules to organize. When compiling each file, the target file (object   file) is generated instead of the executable file that was previously said. Typically, a source file is compiled with a target file. The contents of these target files are basically executable code, but because they are only part of the entire project, we cannot run them directly. After all the source files have been compiled, we can finally "package" these semi-finished target files into an executable file, which is the responsibility of another program, because this process seems to be to assemble the target file containing executable code, so called link, And the program that is responsible for linking is called ... called the link Program (Linker). In addition to linking the target file, there may be a variety of resources, such as icon files, sound files and so on, but also responsible for removing redundant duplication of code between the target files, and so on. Once the link is complete, you will generally get the executable file we want.  

2. interpreted Language : A program written in an explanatory language does not precompile and stores program code in text form. When you publish a program, it appears that you are saving the compile operation. However, when you run the program, the explanatory language must first be interpreted and then run . In general, the existing explanatory language is a line-by-row interpretation of the sentence, the implementation of a sentence in such a way to build. Such explanatory language should be translated once every time it is executed, and the efficiency is lower. In an explanatory program, because the program is always in the form of source code, the porting is almost no problem as long as there is a corresponding interpreter. The advantage of the release program is that when a syntax error occurs in a statement, the programmer's attention can be drawn immediately, and the programmer can correct it during the development of the program.

3. Hybrid : Java is very special, Java programs need to be compiled, but not directly compiled called machine language, but rather compiled called bytecode, and then on the Java Virtual machine with the interpretation of the code to execute bytecode. Python also uses a Java-like compilation pattern, which first compiles the Python program into Python bytecode, which is then interpreted by a dedicated Python bytecode interpreter to interpret the execution byte code.

compiled vs explanatory type

Compiled type
Pros: Compilers typically have pre-compiled procedures to optimize code. Because the compilation is done only once, the runtime does not need to compile, so the program execution of the compiled language is highly efficient. Can run independently from the language environment.

Cons: After compilation, the entire module needs to be recompiled if modifications are required. When compiling the machine code according to the corresponding running environment, porting between different operating systems will be problematic, and you need to compile different executables according to the operating system environment you are running.

Explanatory type
Pros: Good platform compatibility, can be run in any environment, provided the interpreter (virtual machine) is installed. Flexible, modify the code when the direct modification can be quickly deployed, without downtime maintenance.

Cons: Every time you run, you have to explain it again, performance is not as good as the compiled language.

third, dynamic language and static language

Usually we call dynamic language, static language refers to dynamic type language and static type ( data type ) language.

1. Dynamic Type language: Dynamic type language refers to the language of data type checking during run time, that is, when programming in a dynamic type language, you never have to specify a data type for any variable, and the language will record the data type internally when you assign it to a variable for the first time. Python and Ruby are a typical dynamic type language, and many other scripting languages, such as VBScript, are also dynamic type languages.

2, static type language: Static type language is just the opposite of dynamic type language, its data type is checked during compilation, that is, when writing a program to declare all variables of the data type, C + + is a static type of language typical representative, other static type language also has C #, Java and so on.

Four, strong type definition language and weak type definition language

1. strongly typed definition language : Enforces the language of the data type definition . In other words, once a variable is assigned a data type, it is always the data type if it is not cast. For example: If you define an integer variable A, the program simply cannot treat a as a string type. A strongly typed definition language is a type-safe language.

2, weak type definition language : The data type can be ignored language. In contrast to strongly typed definition languages, a variable can assign values of different data types.

Strongly typed definition language may be slightly slower than weak type definition language, but the rigor of strong type definition language can effectively avoid many errors. In addition, "The language is not a dynamic language" and "the language is the type of security" is completely no connection between!
For example: Python is a dynamic language and is a strongly typed definition language (type-safe language); VBScript is a dynamic language and is a weak type definition language (type unsafe language); Java is a static language and is a strongly typed definition language (type-safe language).

Python's basic knowledge of computer language--classification of programming languages

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.