Differences between an explanatory language and a compilation language

Source: Internet
Author: User

The difference between an explanatory language and a compiled language a computer cannot directly understand a high-level language, but can only directly understand a machine language. Therefore, it is necessary to translate a high-level language into a machine language, only computers can execute programs written in advanced languages. There are two translation methods: Compilation and interpretation. The two methods only have different translation time. Before executing a program written in a compiled language, a special compilation process is required to compile the program into a machine language file, such as an exe file, if you want to run it later, you don't need to translate it again. You just need to use the compilation result (exe file). Because the translation is only done once, you don't need to translate it during the runtime, therefore, the execution efficiency of compiled languages is high. Different interpretations of an explanatory language do not require compilation of an interpreted language program. This saves a lot of time for an interpreted language to translate when it runs a program, for example, an interpreted java language, A special interpreter can directly execute java programs, and each statement is translated only when executed. In this way, each execution of an explanatory language requires a translation, which is less efficient. The scripting language is an explanatory language. Generally, the script language has a corresponding Script Engine for interpretation and execution. They generally need interpreters to run. Therefore, as long as the system has corresponding language interpreter programs, it can be used across platforms. A scripting language is an explanatory language, such as vbscript, javascript, and installshield script. Unlike c \ c ++, it can be compiled into binary code and can exist in the form of executable files. JAVA is an explanatory language. Java is very special. java programs also need to be compiled, but not directly compiled as the machine language. Instead, compilation is called bytecode and then executed in an interpreted way. Java can be compiled or interpreted. Through the compiler, you can translate a Java program into an intermediate code called bytecode-a platform-independent code that can be interpreted by the Java interpreter. Through the interpreter, each Java byte command is analyzed and then run on the computer. You only need to compile the program once and explain it during the running of the program. The Java bytecode of www.2cto.com makes it possible to "write once and run everywhere. Java programs can be compiled into bytecode on any platform with a Java compiler. This bytecode can run on any Java VM. For example, the same Java program can run on WindowsNT, Solaris, and Macintosh. Differences between compilers and interpreters: compiler and interpreter have their own advantages and disadvantages. Because the program runs fast and has low requirements on the system under the same conditions, it is used for operating systems, large applications, and database systems, c/C ++ and Pascal/Object Pascal (Delphi) are compilation languages, some programs such as web scripts, server scripts, and auxiliary development interfaces that do not have high speed requirements and have certain requirements on the compatibility between different system platforms usually use explanatory languages, such as Java, JavaScript, VBScript, Perl, Python, Ruby, and MATLAB. Does the compiled language have a better cross-platform performance than the explanatory language? Compile language, for example, C language: After a program is developed in C language, the program needs to be compiled into a machine language (that is, a binary file recognized by a computer, because the binary files recognized by computers in different operating systems are different), you need to re-compile the C language program after porting it. (For example, compiling windows into ext files and linux into erp files ). For example, in java, java programs are first compiled into class files through the compiler. If they are run on windows, they are explained through the java Virtual Machine (VM) on windows. If it runs on the linux platform, it is interpreted and executed through the Java Virtual Machine on the linux platform. Therefore, cross-platform deployment is required only when a matched Java Virtual Machine is available on the platform. If you do not have a Java virtual machine, you cannot perform cross-platform operations.

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.