Computer understands the instructions written in machine language. Thus the program written in any other language needs to be translated into machine language. This task is done by translators which are special program to check user program grammatically and produce a corresponding set of machine language. There are two types of translators.
(1) Compiler
(2) Interpreter
Compiler
A compiler is a special program which checks the entire use program (source code) at once and produced to complete code into machine language or object code if there are errors in the source code. It will display all the errors at once so that you can remove all the errors and execute the program. It will not convert the source code into object or executable code. If there is any error in the source code and after removing all the errors it converts t he whole program into object code.
Interpreter
It is also a translator but functioning of it is different from compiler because it translates one statement at a time. It translates and executes the first instruction before going to second error. Checking is easier in this case because of line by line translation. The only disadvantage of this translator is that it takes more time for execution.