compiler language and interpretive language analysis

Source: Internet
Author: User

Common compiled and interpreted languages

Computers can not directly understand the high-level language, only directly understand the machine language, so the high-level language must be translated into machine language, the computer to perform high-level language programming programs.

There are two ways of machine translation, one is compilation , the other is explanation . The two ways are only different in the time of translation.

Explanatory languages : Java, Python, Perl, C #, JavaScript, VBScript, Ruby, Matlab, and more.
Compiler language : C/C + +, Pascal/object Pascal (Delphi) and so on.

Compiler Language

Compiled language written by the program before the execution, need a special compilation process, the program compiled into machine language files, such as EXE files, later to run without re-translation, directly using the results of the compilation (EXE file), because the translation is done only once, the runtime does not need to translate, Therefore, the program execution efficiency of the compiled language is high.

Explanatory language

Interpretation is different, the interpretation of the language of the program does not need to compile , save the process, the interpretation of the language in the process of running the translation, such as the explanatory Java language, a special interpreter can directly execute the Java program, each statement is executed when the translation. Such explanatory language should be translated once every time it is executed, and the efficiency is lower.
  

scripting language

Scripting language is an explanatory language. Scripting languages generally have a corresponding scripting engine to interpret execution. They typically require an interpreter to run. So as long as the system has the corresponding language interpretation program can be done cross-platform. Scripting language is an explanatory language, such as Vbscript,javascript,install Shield script, and so on, it is not like c\c++, etc. can be compiled into binary code, in the form of executable files exist.

The scripting language does not need to be compiled, can be used directly, and is interpreted by the interpreter.

Java language

The Java language is a special interpretive language. Java programs also need to be compiled, but not directly compiled as machine language, but compiled into bytecode , and then execute bytecode in an interpreted manner. Java can be either compiled or interpreted. With the compiler, you can translate a Java program into an intermediate code called a bytecode-platform-independent code that can be interpreted by the Java interpreter. Through the interpreter, each Java byte instruction is parsed and then run on the computer. Just compile once, and the program runs to interpret execution to achieve cross-platform functionality.
  
Java bytecode makes it possible to "write once, run everywhere". Java programs can be compiled into bytecode on any platform that has a Java compiler. This bytecode can be run on any JVM (Java Virtual machine). For example, the same Java program can run on WindowsNT, Solaris, and Macintosh.
  

the difference between a compiler and an interpreter

A compiled language before the program executes, there is a separate compilation process that translates the program into machine language, which is no longer translated when the program is executed.

The interpreted language, which translates the program into machine language at run time, is slower than the compiled language .

Compiled and interpreted type, both have pros and cons. The former because of the fast program execution, the same conditions on the system requirements are low, so like the development of operating systems, large applications, database systems, such as the use of it, such as C + +, Pascal/object Pascal (Delphi) are compiled languages, and some web scripts, Server Scripts and auxiliary development interfaces for applications where speed requirements are not high and the compatibility of different system platforms are required, it is common to use explanatory languages such as Java, JavaScript, VBScript, Perl, Python, Ruby, MATLAB, and so on.
  

The compiler language is not as good as the cross-platform of explanatory language.

Compiled languages such as C: After the program is developed in C, the program needs to be compiled into machine language by the compiler (i.e., computer-recognized binaries, because the binary files identified by different operating system computers are different), so the C-language program will be re-compiled after porting. (such as Windows compiled into ext files, Linux compiled into ERP files).

Explanatory languages, such as the Java language, are first compiled by a compiler into a. class file and interpreted by a Java Virtual machine (VM) on the Windows platform if it is run on a Windows platform. If running on a Linux platform, the Java Virtual machine on the Linux platform is interpreted and executed. So you can cross-platform, if the platform must have a matching Java virtual machine. If you do not have a Java virtual machine, you cannot cross-platform.

Copyright NOTICE: This article is for bloggers original articles, reproduced please indicate the source.

compiler language and interpretive language analysis

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.