Table of Contents
*This post may contain affiliate links. As an Amazon Associate we earn from qualifying purchases.
The implementation of a language includes compilation and interpretation.?Depending on the implementation, you can interpret and compile any language. Before deciding the winner in the compiled vs interpreted language, we have to understand a few basic things first.
It is wrong to think that a language is compiled or interpreted because these two properties belong to the implementation of that language, so they cannot be regarded as a part of the language itself.
The definition of Compilation
A compiled language implementation is a process during which a compiler translates the program into a specific code suited to the target machine or the machine code. This code is specific to a given operating system or processor.
After the translation has been completed, the computer will operate the machine code by itself.
The definition of Interpretation
Compared with the previous example, when it comes to the interpreted implementation of a language, the target machine does not operate the source code on its own.
This operation is done by another program, also known as the Interpreter, which first reads and then runs the original source code. This Interpreter is basically a tool written mainly for the native machine.
During interpretation, you have to convert the original source code in an intermediate code which will be processed by the Interpreter. Only then does the interpreter convert the given intermediate code into machine specific code.
Compiled vs Interpreted Language Accomplishments
First of all, these two properties can substitute each other. For example, translations can be done in some cases by interpreters as well, even if this is usually the main function of a compiler. In other words, an interpreter can sometimes do the same work as the compiler.
It means that these two languages can have the same accomplishments but both of them have advantages and disadvantages as well, so compiled vs interpreted language might turn out to be a tie after all.
Compiled vs Interpreted Language Advantages and Disadvantages
It is worth mentioning that this comparison can only be general because interpretation and compilation depend on the type of implementation of the compiler and interpreter.
- It is quite challenging to write compilers, so it is usually easier to rely on interpreted language implementations.
- Interpreted language implementations are more movable than compiled language implementations.
- Compiled language implementations are quite faster than interpreted language implementations thanks to the fact that the translation is made straight to the specific machine?s native code.
Overall, there is a 1-2 score in the compiled vs interpreted language duel.
Is Java compiled or interpreted?
It seems that Java contains both compiled and interpreted implementations. The difference lies in the fact that the JVM might be different.
Therefore, a JVM might either interpret or compile a bytecode. The one which interprets the bytecode will both execute and translate the bytecode simultaneously, whereas the translation takes place just once with a JVM compiler.
If a machine has its own JVM it can always operate a Java bytecode, because Java is machine and hardware independent. Interpreted language appears to be once again the winner in the compiled vs interpreted language battle because it has more advantages when it comes to Java as well.