What is the difference between a compiler and an interpreter?

Answer:
A compiler translates code from a source language (e.g. C, C++, Java) to a target language, which can then be executed by a (virtual or physical) machine.

An interpreter reads code in an interpreted language (e.g. PHP, Perl, JavaScript) and directly executes the contained instructions.
Note: There are comments associated with this question. See the discussion page to add to the conversation.
Contributor: Freddy
First answer by ID2988078654. Last edit by ID2988078654. Question popularity: 93 [Recommended].