A compiler reads a computer program as a whole, while an interpreter reads a computer program line by line.