A compiler is a program that translates a source program written in some high-level programming language (such as Java) into machine code for some computer architecture (such as the Intel Pentium architecture). The generated machine code can be later executed many times against different data each time.
An interpreter reads an executable source program written in a high-level programming language as well as data for this program, and it runs the program against the data to produce some results. One example is the Unix shell interpreter, which runs operating system commands interactively.
The major difference between the compiler and interpreter is
The compiler converts the source code into machine code at a time whereas the interpreter compiles and execute the source program line by line.Every time each instruction get executed,an intermediate code is generated temporarily.The interpreter does not produce object program.It read source program, translates it and goes ahead to execute it.The object program provided by a compiler fastens execution than any interpreter can do in the running of a program, the use of object program may however pose a problem where there is an error as it is very time consuming to discover the source of error, a compiler is capable of producing a machine code generated by it at any time, whereas an interpreter can only execute the source program.Interpreters are widely used, particularly for the programming language BASIC on small computers, because they are easier to use for beginners than compilers.
The advantage of interpreters over compilers is that an error is found immediately. So the programmer can make corrections during program development. Error is not found immediately,the programmer has to check carefully where the error has occurred.
The disadvantage of interpreter is that it is not so efficient.
The disadvantage of interpreter is that it is not so efficient.
Comment for any doubts.....