💻

Translators and Their Types

Jun 27, 2024

Translators and Their Types

Introduction

  • 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

  1. 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).
  2. 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.
    • Examples: GCC (GNU Compiler Collection), COBOL (Common Business-Oriented Language).
  3. Interpreter

    • Purpose: Converts high-level language into machine-level language one line at a time.
    • Process:
      • Step-by-step execution makes error detection easier.
      • Executes code immediately upon reading.
      • Stops at the first error encountered and prints the error message.
    • Example Test: Python interpreter step-by-step execution, detects error in the third line and stops.
    • Examples: Python, LISP (List Processing).

Conclusion

  • Next video will cover more topics on programming concepts.