1. What is a Translator?
A translator is software that converts code written in one programming language into another. Computers can only understand machine language (binary code), so translators bridge the gap between human-readable code and machine-executable instructions.
2. Types of Translators
There are three main types of translators:
-> Compiler
A compiler converts the entire source code into machine code at once and generates an executable file.
Example: C compiler, Java compiler.
-> Interpreter
An interpreter translates and executes the code line by line, with no separate executable file created.
Example: Python interpreter.
-> Assembler
An assembler converts assembly language (low-level, human-readable language) into machine language.
Example: NASM (Netwide Assembler).
3. Why Are Translators Important?
- Make programming easier by allowing developers to write code in high-level languages.
- Ensure programs run on specific hardware by converting them into machine-specific instructions.
- Enable error detection during translation, which improves code quality.
