Difference b/w Compiler Interpreter and Assembler

Difference b/w Compiler Interpreter and Assembler



play-rounded-fill play-rounded-outline play-sharp-fill play-sharp-outline
pause-sharp-outline pause-sharp-fill pause-rounded-outline pause-rounded-fill
00:00
ยฉ 2018 Flowplayer ABAbout FlowplayerGPL based license

Hereโ€™s a clear and concise comparison between Compiler, Interpreter, and Assembler, including their definitions, differences, and a table for quick revision.


Contents [hide]

๐Ÿ”ง 1. Compiler

  • ๐Ÿ”น Definition: A compiler is a program that translates the entire source code of a high-level language (like C, C++, Java) into machine code (binary) at once.
  • ๐Ÿ”น Output: Generates an executable file (.exe).
  • ๐Ÿ”น Execution Speed: Fast (after compilation).
  • ๐Ÿ”น Example Languages: C, C++, Java (partially).

๐Ÿงฎ 2. Interpreter

  • ๐Ÿ”น Definition: An interpreter translates line-by-line of source code into machine code and executes it immediately.
  • ๐Ÿ”น Output: No executable file is created.
  • ๐Ÿ”น Execution Speed: Slower (interprets each line every time).
  • ๐Ÿ”น Example Languages: Python, JavaScript, Ruby.

โš™๏ธ 3. Assembler

  • ๐Ÿ”น Definition: An assembler converts assembly language (low-level language) into machine code.
  • ๐Ÿ”น Output: Machine code (binary).
  • ๐Ÿ”น Used For: Assembly language programming (e.g., using instructions like MOV, ADD).
  • ๐Ÿ”น Example: MASM (Microsoft Assembler), NASM.

๐Ÿ“Š Comparison Table

Feature Compiler Interpreter Assembler
Input High-Level Language High-Level Language Assembly Language
Output Machine Code / Executable File Direct Execution Machine Code
Execution Style Translates all at once Translates one line at a time Translates all at once
Speed Fast (after compilation) Slower (runs line-by-line) Fast
Error Handling Shows all errors after compilation Shows errors one by one Shows all errors after conversion
Examples C, C++, Java (JVM compiles bytecode) Python, JavaScript, BASIC NASM, MASM

๐Ÿ“Œ Summary in One Line:

  • Compiler โ†’ Full code โ†’ Executable
  • Interpreter โ†’ Line-by-line โ†’ Direct Execution
  • Assembler โ†’ Assembly โ†’ Machine Code

If youโ€™d like a PDF summary, visual diagram, or practice questions based on this topic (useful for GATE, NET, B.Tech, etc.), let me know and Iโ€™ll prepare that too!

Difference b/w Compiler Interpreter and Assembler

Assembler, Compiler, Linker, Interpreter, Loader

Compiler and Interpreter



Leave a Reply

Your email address will not be published. Required fields are marked *

error: