+ 5
A compiler or an interpreter is a program that converts program written in high-level language into machine code understood by the computer, but they don't work in the same way.
Interpreter: Translates program one statement at a time.
Compiler: Scans the entire program and translates it as a whole into machine code.
+-------++-------++-------++-------++-------++-------+
Interpreter: It takes less amount of time to analyze the source code but the overall execution time is slower.
Compiler: It takes large amount of time to analyze the source code but the overall execution time is comparatively faster.
+-------++-------++-------++-------++-------++-------+
Interpreter: No intermediate object code is generated, hence are memory efficient.
Compiler: Generates intermediate object code which further requires linking, hence requires more memory.
+-------++-------++-------++-------++-------++-------+
Interpreter: Continues translating the program until the first error is met, in which case it stops. Hence debugging is easy.
Compiler: It generates the error message only after scanning the whole program. Hence debugging is comparatively hard.