Another important distinction is whether or not a language is compiled or interpreted before execution. As with assembly language, a compiled language is translated directly into machine-readable binary code by a special program called a compiler. The result is a program file that can then be subsequently run without needing to refer to the human-readable source code. A program written in an interpreted language, on the other hand, is executed directly from the source code by a program called an interpreter. Compiled languages typically have higher performance and lower memory requirements than interpreted languages, because they do not require the overhead of running through a software interpreter. However, they often require a lengthy and tedious compilation before results from any changes can be seen, which often makes development more rapid with interpreted languages. Interpreted languages also often provide many easy-to-use features, since these can be implemented in the interpreter software, which acts like a 'virtual machine' with a different structure than the underlying machine hardware.
Many interpreted languages are simply long sequences of commands which could be entered manually by a user at an interactive text-based interface, which are grouped together for convenience, clarity, and ease of reuse. Such languages are often called scripting languages, and the programs are called scripts, since they provide a 'script' for the system to follow. Scripting languages are very popular in complex software systems such as databases and sophisticated data processing software. These languages can give greater power to the user of such software, allowing them to more fully leverage all of the features of the system.
Not all languages are strictly either compiled or interpreted; there are a host of subtle variations in the compilation and execution strategies employed by different languages. While many simple scripting languages interpret and execute the text of the code one line at a time, others, such as Perl, will transform all of the text into some internal structure which is then run as a program. Languages such as Java, Python, and the .Net family of languages are compiled, not to the native machine code of any particular computer hardware, but to a hardware-independent universal binary format. This standardized byte code can then either be itself interpreted through a virtual machine which maps each instruction to its machine-native counterpart, or it can be compiled to native code at run time (called 'just-in-time compilation'). This strategy allows a language such as Java to have some of the performance benefits of compiled languages, while allowing the same compiled code to be run on many different platforms.
Was this article helpful?