Compiler
• Translates entire program at once
• Produces standalone executable file
• Execution is fast (no translation during runtime)
• Error reporting happens before execution
• If errors found, must recompile entire program after fixes
Interpreter
• Translates and executes line-by-line
• No standalone executable produced
• Slower execution (translation happens every run)
• Immediate error detection
• Useful for development and debugging
• Source code must be present to run
Assembler
• Translates assembly to machine code
• One-to-one correspondence (mostly)
• Allows direct hardware control
• Highly efficient code
• Not portable across different CPU architectures
• Used for system-level programming
Translator Comparison
• Compiler: High-level language
• Interpreter: High-level language
• Assembler: Assembly language
Output
• Compiler: Machine code/executable
• Interpreter: Direct execution
• Assembler: Machine code
Execution Speed
• Compiler: Fast
• Interpreter: Slower
• Assembler: Fast
Error Detection
• Compiler: Before execution
• Interpreter: During execution
• Assembler: During assembly
Portability
• Compiler: Compiled for specific platform
• Interpreter: Source portable (needs interpreter)
• Assembler: Architecture-specific
Use Case
• Compiler: Production software
• Interpreter: Development, scripting
• Assembler: System programming
• Compiler - Production software where speed matters
• Interpreter - Development, testing, scripting languages (Python, JavaScript)
• Assembler - Operating systems, device drivers, embedded systems