What Is a Compiled Language?
Compiled languages run relative to interpreted languages. Compiled languages first compile source code into machine language, and then the machine runs machine code (binary). Languages like C / C ++ are compiled languages.
- Chinese name
- Compiled language
- Compiled language
- Relative to interpreted language
- Function
- First compile the source code into machine language
- E.g
- C / C ++, etc.
- Compiled languages run relative to interpreted languages. Compiled languages first compile source code into machine language, and then the machine runs machine code (binary). Languages like C / C ++ are compiled languages.
- Compiled language: Before the program is executed, it needs a special compilation process to compile the program into a machine language file. It does not need to be re-translated at runtime, and the compiled results are used directly. Program execution efficiency is high, it depends on the compiler, and cross-platform is poor. Such as C, C ++, Delphi, etc. [1]
- In contrast, programs written in interpreted languages are not precompiled, and program code is stored in text. When publishing the program, it seemed that the compilation process was saved. However, when running a program, the interpreted language must be interpreted before running . [2]
Compiler written in compiled language
- Before executing a program written in a compiled language, a special compilation process is needed to compile the program into a machine language file, such as an exe file. If you want to run it in the future, you don't need to re-translate. Use the compiled result directly (exe file) Because the translation is done only once and no translation is required at runtime, the execution of programs in compiled languages is efficient.
The difference between compiled and interpreted languages
- An interpreted language is translated only when the program is run. For example, an interpreted basic language, there is a special interpreter that can directly execute the basic program. Each statement is translated only when it is executed. In this way, the interpreted language needs to be translated every time it is executed, which is relatively inefficient.
Compiled language Compiled and interpreted, both have advantages and disadvantages
- The former has fast program execution and low system requirements under the same conditions, so it is used when developing operating systems, large applications, database systems, etc. C, C ++, Pascal / Object Pascal (Delphi), etc. Languages, and some web scripts, server scripts, and auxiliary development interfaces, such as programs that do not require high speed and have certain requirements for compatibility between different system platforms, usually use interpreted languages, such as Java, JavaScript, VBScript, Perl, Python, Ruby, MATLAB, and more. [3]
Compiled languagesCompiled languages are not as cross-platform as interpreted languages
- Compilable language such as c language: After the program is developed in c language, the program needs to be compiled into machine language by the compiler (that is, the binary files recognized by the computer, because the binary files recognized by different operating systems are different), so c After the language program is transplanted, it must be recompiled. (Such as windows compiled into ext files, linux compiled into erp files). [3]
- An interpreted language, such as the Java language, a Java program is first compiled into a class file by a compiler, and if it is run on a windows platform, it is interpreted by a java virtual machine (VM) on the windows platform. If running on a Linux platform, the Java virtual machine on the Linux platform is used for interpretation and execution. Therefore, it can be cross-platform, provided that there is a matching java virtual machine on the platform. If there is no java virtual machine, cross-platform cannot be performed. [3]
Compiled language interpreted language
- Programs written in interpreted languages are not precompiled, and the program code is stored as text. When publishing the program, it seemed that the compilation process was saved. However, when running a program, the interpreted language must be interpreted before running . For example, in the interpreted Basic language, when a Basic interpreter executes a Basic program, it will read and interpret each statement one by one. This is actually a compilation process and then executed. Generally speaking, existing interpreted languages are constructed by interpreting a sentence line by line and executing a sentence. In this way, the interpreted language needs to be translated every time it is executed, which is relatively inefficient. [2]