Back

Blog Image
author-img

Compiler vs Interpreter

March 18, 2025, 11:48 p.m.


  1. What is Translator?

    • A translator is a person or tool that converts text or speech from one language to another.
  2. Why do we need translator?

    • Computer program written using high-level language.
    • Only humans are capable to understand high-level language.
    • Translator - converts high level language code to the binary language code which machines can understand.
  3. How many types of translators? What are they?

    • 2 types of translators
    • Compiler
    • Interpretor

Compiler

  1. What is compiler?

    • Compiler is complex piece of software whose job is to convert source code (i.e) human understandable to machine understandable code (i.e) binary code in one go.

    • Before running a code we need to compile.

    • After compiled, the compiler translates the source code to machine executable code.
    • The executable code will run on the machine.
    • If we compile thr code in windows machine then the executable file extention would be .exe
    • Also we will get object file. (need not to worry)

Compilation

Note: C is compiled programming language.

Interpreter

  1. What is interpreter?

    • Interpreter is a software program written to translate source code (i.e) human understandable to machine understandable code (i.e) binary code but it does that by line by line.

    • Convert each line one by one to machine code on the fly (at run time).

    • Machine 2 also required machine code.

    • We don't get executable in response.

Interpreter

Note: JS is interpreted programming language.

Compiler vs Interpreter

Pros of compiled languages

Cons of compiled languages

Pros of interpreted languages

Cons of interpreted languages

Hybrid Approach

Examples

Hybrid

Is pthon interpreted or compiled language?

Hybrid Eg

Example: Bytecode Generation

Bytecode Eg


Last updated: March 22, 2025, 5:01 p.m.