Scenario: Two people communicate - one knows English, the other knows Hindi. A translator who knows both languages is needed for successful communication.
Similarly, a translator is needed to convert programming language into machine language for communication between programmer and computer.
What is a Translator?
Definition: A programming language processor that converts a computer program from one language to another.
Function: Takes a program written in source code and converts it into machine code, identifying errors during the process.
Types of Translators
Assembler
Purpose: Translates assembly language into machine-level language.
Process: Source program (assembly language) is input; output is object code or machine code.
Examples: FAB (Fortran Assembly Program), MAP (Macro Assembly Program).
Compiler
Purpose: Converts high-level language into machine-level language.
Process:
Reads the complete source program.
If error-free, converts into machine-level language.
If errors exist, specifies them at the end of the compilation process.
Example Issues: Missing semicolons results in compilation errors.