LANGUAGE PROCESSORS
Language processor is a special translator system
used for processing programs written in assembly language or high-level
language to machine code. It performs the task of translation and
interpretation needed for processing a specified programming language.
There are three types of
language processor
1. Assembler
2. Compiler
3. Interpreter
ASSEMBLER
An assembler is a language processor that translates program from an assembly language into corresponding machine code. Machine code is a set of instructions written in binary digits (0’s and 1’s) and executed directly by the CPU. A disassembler is a software that translates machine language into its corresponding assembly language.
COMPILER AND INTERPRETER
In general, the computer programs are written in a
high-level programming language that a human can easily understand and
memorize. The code or set of instruction in high-level programming language is
called source code.
However, a computer can only understand programs
written in binary digits, i.e., 0’s and 1’s called the Machine code. Thus, in
order to run or process an instruction written in high level language we need a
converter that converts Source code into Machine code. The conversion is done
with the help of either a Compiler or an Interpreter.
COMPILER
A Compiler is a translator that translates program
from a high-level language into corresponding machine code to make it
understandable by the computers. It scans the entire source program in one go
and translates into machine code all at once. Some of the characteristics of a
compiler are as follows
- A compiler should comply with the syntax rule of the programming language being used.
- All the errors encountered during compilation will be displayed only when the entire compilation process is over.
- On successful error free compilation of entire program, the compiler translates the source code into machine code in a two-step process. During the first step the source code is translated into target code or intermediate code. The target code is then translated into the required machine code during the second step.
- The compiler needs additional memory space to store intermediate results.
- For Example, the programming language that uses compiler for translation are C, C++, JAVA, C# etc.
INTERPRETER
An interpreter is a software program that performs
similar functions as the compiler, but instead of translating the entire source
program at once, the interpreter translates each statement of the source code
into machine code. Some of the characteristics of an interpreter are as follows
- An interpreter analyses the program line by line and displays the error messages if any. When an interpreter detects an error at any specific statement, it stops its further execution until the error is corrected. This way of error correction is easier for debugging.
- Interpreter is a one step process where the source code is translated into machine code at the same time.
- There is no need for additional memory space as the interpreter does not generate intermediate code.
- For Example, the programming language that uses interpreter for translation are PHP, Perl, MATLAB, Ruby etc.
0 Comments