Compiler and Interpreter
What is the main difference between compiler and interpreter?
- Translates program one statement at a time.
- It takes less amount of time to analyze the source code but the overall execution time is slower.
- No intermediate object code is generated, hence is memory efficient.
- Continues translating the program until the first error is met, in which case it stops. Hence debugging is easy.
- Programming languages like Python, Ruby use interpreters.
- Scans the entire program and translates it as a whole into machine code.
- It takes a large amount of time to analyze the source code but the overall execution time is comparatively faster.
- Generates intermediate object code which further requires linking hence requires more memory.
- It generates the error message only after scanning the whole program. Hence debugging is comparatively hard.
- Programming languages like C, C++ use compilers.