A program written in the high-level language is called as source code. To convert the source code into machine code, translators are needed. A translator takes a program written in source language as input and converts it into a program in the target language as output. Translating the high-level language program input into an equivalent machine language program. Providing diagnostic messages wherever the programmer violates specification of the high-level language program.
A compiler is a translator which is used to convert programs in a high-level language to low-level language. It translates the entire program and also reports the errors in source program encountered during the translation. Compliers have diagnostic capabilities and prompt the programmer with appropriate error message while compiling an HLL program. The corrections are to be incorporated into the program, whenever needed, and the program has to be recompiled. The process is repeated until the program is mistake free and translated to an object code.
An interpreter is a translator which is used to convert programs in a high-level language to low-level language. An interpreter translates line by line and reports the error once it encountered during the translation process.
It directly executes the operations specified in the source program when the input is given by the user. Whereas interpreter translates each instruction, executes it and then the next instruction is translated and this goes on until end of the program. In this case, object code is not stored and reused. _Every time the program is executed, the interpreter translates each instruction freshly. It also has program diagnostic capabilities.
Assembler is a translator which is used to translate the assembly language code into machine language code. The translated program is called an object program. Assembler checks each instruction for its correctness and generates diagnostic messages if there are mistakes in the program.