Computer languages can be grouped according to which translation process is used to convert the instructions into binary code.
Assembler:
a program used to translate Assembly language programs. The entire
program is assembled before the program is sent to the computer for
execution.
Interpreter: A program used to translate high-level programs. Translates one line of the program into binary code at a time:
- An instruction is fetched from the original source code.
- The Interpreter checks the single instruction for errors.
- The instruction is translated into binary code.
- The binary coded instruction is executed.
- The fetch and execute process repeats for the entire program.
Compiler: a program used to translate high-level programs.
Translates
the entire program into binary code before anything is sent to the CPU
for execution. The translation process for a compiled program:
- First, the Compiler checks the entire program for syntax errors in the original source code.
- Next,
it translates all of the instructions into binary code. - Two versions
of the same program exist: the original source code version, and the
binary code version (object code).
- Last, the CPU attempts execution only after the programmer requests that the program be executed.
Interpreter Vs Compiler:
- A compiler converts the high level instruction into lower level language (e.g., assembly language or machine code) while an interpreter converts the high level instruction into an intermediate form.
- The compiler executes the entire program at a time, but the interpreter executes each and every line individually.
- List of errors is created by the compiler after the compilation process while an interpreter stops translating after the first error.
- Autonomous executable file is generated by the compiler while interpreter is compulsory for an interpreter program.
- Interpreter is smaller and simpler than compiler
- Interpreter is slower than compiler.