Code Translation: Interpretation and Compilation
Explore the core methods of translating source code into machine code through interpreting and compiling. Understand how interpreters process code line by line, how compilers translate entire programs before execution, and discover languages that use a mix of both approaches. This lesson helps you grasp the advantages and limitations of each technique for better programming insight.
We'll cover the following...
Code translation
The code that a programmer writes is called source code. Earlier, we learned that this code must be translated into machine code so that the computer can understand it. There are two main principles of how this translation is done. We’ll first explore these two concepts and look at their pros and cons before we look at a combination of these two concepts:
- Interpreting
- Compiling
Interpreting and compiling are two of the main techniques for translating source code. A programming language can use either one of these techniques, and a language is therefore often referred to as either an interpreted or compiled language.
Interpreting
One way to carry out this translation is by using an interpreter. An interpreter will look at a single line of source code, translate it into machine code, let the ...