Q3. What is the difference between an interpreter and a compiler?
Ans. An interpreter converts an HLL program into machine language line by line and simultaneously executes the converted line. Also, an interpreter must always be present in the memory along with the program for its execution. If an error occurs in a line, the line is displayed and interpreter does not proceed unless the error is rectified.
A compiler converts an HLL program into machine language in one go. If there are errors in the program, its gives the error list along with the line numbers. Once the errors are removed, error-free object code is made available and after this compiler is no more needed in the memory.