Module 02 Compiled vs. Interpreted Languages: Background
Module 02 Compiled vs. Interpreted Languages: Background
1
Compiled vs. Interpreted Languages
Background
When writing programs in a high level language, the computer will not be able to understand
it. So that it will be usable, you need to convert it into something that a computer understands. This is
where compilers and interpreters come in as they both do the same function – convert a high level
language (like C, Java) instructions into the binary form which is understandable by computer
hardware.
They are the software used to execute the high level programs and codes to perform various
tasks. Specific compilers/interpreters are designed for different high level languages. However both
compiler and interpreter have the same objective but they differ in the way they accomplish their task
Programming languages can be divided into two major categories: low level and high level.
“Assembly language” and “machine language” are called low-level languages because they more than
others “speak” the language the computer understands. On the other hand, C, C++, Pascal, Python,
Visual Basic, Java, and COBOL are high-level languages because they require more manipulation by
the computer, a process called compiling.
An interpreter:
Reads the source code one instruction or line at a time, converts this line into machine code
and executes it. The machine code is then discarded and the next line is read. Executing each
line as it is "translated," much the way a foreign language interpreter would translate a book,
by translating one line at a time.
The interpreter takes one statement then translates it and executes it and then takes another
statement.
Interpreter stops translating after the first error.
Course Module
Integrative Programming and Technologies 1
2
Compiled vs. Interpreted Languages
A compiler can be compared to taking a foreign movie and first sub-titling it and then being able to
watch it again and again.
While an interpreter is like having a translator at the UN translate each line of a delegate’s speech in
real time.
Course Module
Integrative Programming and Technologies 1
3
Compiled vs. Interpreted Languages
Hybrid Approach
An interpretive compiler combines fast translation with moderately fast execution, provided that:
● VM code is lower than the source language, but higher than native machine code
● VM instructions have simple formats (can be quickly analyzed by an interpreter)
Course Module