What are a compiler, an interpreter, and an assembler? Explain their functions and differences.

What are a compiler, an interpreter, and an assembler? Explain their functions and differences.

From the Combined Bank Assistant Programmer (CSE) October 2026 – Written (BIBM) exam, question 6 of 21.

Answers (1)

All three are language translators that turn source code into something the machine can run.

  • Compiler: translates the whole high-level program (C, C++) into machine code at once, producing an executable. Errors are reported after the whole program is analysed. Phases: lexical analysis, syntax analysis, semantic analysis, intermediate code, optimization, code generation.
  • Interpreter: translates and executes the program one statement at a time (Python, JavaScript, BASIC). It stops at the first error; no separate executable is created.
  • Assembler: translates assembly language (mnemonics such as MOV, ADD) into machine code, one-to-one.
PointCompilerInterpreterAssembler
InputHigh-level languageHigh-level languageAssembly language
Translation unitWhole programLine by lineWhole program
OutputExecutable fileNone (runs directly)Object / machine code
Execution speedFastSlowerFast
Error reportingAll after compilingOne at a time, stopsAfter assembling
MemoryMore (object code)LessLess
ExamplesGCC, javacCPython, Node.jsNASM, MASM

(Java uses both: javac compiles to bytecode, which the JVM interprets and JIT-compiles.)

— rhs

More from this paper