The difference between an interpreted and a compiled language lies in the result of the process of interpreting or compiling. An interpreter produces a result from a program, while a compiler produces a program written in assembly language. The assembler of architecture then turns the resulting program into binary code.
A compiled program is not human readable, but instead is in an architecture-specific machine language. It is one where the program, once compiled, is expressed in the instructions of the target machine. For example, an addition ?+? operation in your source code could be translated directly to the ?ADD? instruction in machine code.
Creating a compiled program requires several steps. First, the programmer, using a development tool or even a simple text editor, writes the source code in a chosen computer language. If the program is complex, pieces of it may be spread across several files. The programmer then compiles the program, sorting and linking the modules and translating it all into machine code that the computer understands.The nowadays IDEs (Interface Development Environment) the compiling step is done in a very easy and seamless way, just by making a few clicks.
In an interpreted program however, the source code is typically is program. Often known as scripts, require an interpreter, which parses the commands in the program and then executes them. The advantage of a script is that it is very portable. The instructions are not directly executed by the target machine, but instead read and executed by some other program. Following the previous example of the addition example, the same ?+? operation in this kind of languages, would be recognized by the interpreter at run time, which would then call its own ?add(a,b)? function with the appropriate arguments, which would then execute the machine code ?ADD? instruction. Any computer that has the appropriate interpreter installed may run the program more or less unchanged. This is a disadvantage as well, because the program will not run at all if the interpreter is not available. In general, interpreted programs are slower than compiled programs, but are easier to debug and revise.
You can do anything that you can do in an interpreted language in a compiled language and vice-versa they are both Turing complete. Both however they have advantages and disadvantages for implementation and use.
Advantages of Compiled Languages
Programs compiled into native code at compile time usually tend to be faster than those translated at run time, due to the overhead of the translation process.
Disadvantages of Compiled Languages
The most notable disadvantages are :
- Additional time needed to complete the entire compilation step before testing.
- Platform dependence of the generated binary code.
Advantages of Interpreted Languages
Provides implementation with some additional flexibility over compiled implementations. Because interpreters execute the source program code themselves, the code itself is platform independent. Other advantages include dynamic typing, and smaller executable program size.
Disadvantages of Interpreted Languages
- Interpreters can be susceptible to Code injection attacks.
- Slower execution compared to direct native machine code execution. A technique used to improve performance is just-in-time compilation which converts frequently executed sequences of interpreted instruction to host machine code.
- Source code can be read and copied, or more easily reverse engineered through reflection in applications where intellectual property has a commercial advantage. In some cases, obfuscation is used as a partial defense against this.
In the Wikipedia you can find a list of Compiled Languages:
A compiled language is a programming language whose implementations are typically compilers (translators that generate?
In the Wikipedia you can also find a list of Interpreted Languages:
An interpreted language is a type of programming language for which most of its implementations execute instructions?