- Asked 3/16
- 2071 Chaitra · 4 marks
- 2069 Chaitra · 2 marks
- 2067 Asoj · 2 marks
Compiler versus interpreter
Short answer
A compiler translates the whole source program into machine code at once, producing an executable file and reporting all errors after compilation. An interpreter translates and executes one statement at a time without an object file, stopping at the first error and running slower.
What is compilation? What is interpretation? How do these two processes differ? (Differentiate between compiler and interpreter.)
Compilation is the process of translating the whole source program of a high-level language into machine code (object code) in one go, reporting all errors after reading the full program. The translator is called a compiler.
Interpretation is the process of translating and executing the source program one statement at a time, without producing a separate object file. The translator is called an interpreter.
| Compiler | Interpreter |
|---|---|
| Translates the whole program at once | Translates one statement at a time |
| Produces an object/executable file | Produces no object file |
| Execution is fast, since translation is done once | Execution is slow, since it translates every time |
| Shows all errors after compilation | Stops at the first error found |
| Needs more memory for the object code | Needs less memory |
| Debugging is harder | Debugging is easier |
| Examples: C, C++, FORTRAN compilers | Examples: BASIC, Python, JavaScript interpreters |
✓ Answer checked by Claude Opus 5.5 (high effort)
Related questions
- Structure versus array · Computer Programming, chapter 8 · asked 4×
- High level languages; C versus FORTRAN · Computer Programming, chapter 1
- Algorithm versus pseudo-code · Computer Programming, chapter 2
- Call by value versus call by reference · Computer Programming, chapter 6 · asked 8×
- do...while versus for/while loops · Computer Programming, chapter 5 · asked 2×
- Text file versus binary file · Computer Programming, chapter 10
- Test: two bulb brands differ in quality · Probability and Statistics, chapter 6
- Test: mean weights of two processes · Probability and Statistics, chapter 6
- Two-stroke versus four-stroke engines · Automotive Technology, chapter 1
- Deadlock, postponement, prevention, 2 processes · Operating System, chapter 7