Table of Contents
A language processor is a type of software that is used to translate a program from a high-level language into a low-level language. Because the computer only understands the program written in the low-level language. Let’s read further for more information.
The computer understands only machine language. A computer cannot directly execute a program written in high-level or assembly language. Before execution, the program must be converted into machine language.
Language processor or translators is software that converts these programs into machine languages. Every computer language has its own translators also.
Types of Language Processor
Different types of language processors are as follows:
A compiler is a program that converts the instructions of a high-level language into machine language as a whole. A high-level language program is called a source program. Compiler converts source program into machine code. This machine code is known as an object program.
Furthermore, The compiler verifies every statement in the source program and produces machine instructions. Syntax errors in the program are also checked by the compiler. A source program containing an error cannot be compiled.
A compiler translates the programs of only that language for which it is written. For example, the C compiler can translate only those programs that are written in the C language.
An interpreter is a program that converts one statement of a program at one time. Before translating the next statement of the source program, It executes this statement first. if there is an error in the statements, the interpreter stops working and displays the error message.
Furthermore, the advantages of interpreters over compilers are that an error is found immediately. so the programmer can correct errors during program development.
The drawback of an interpreter is that it is not very competent. The interpreter does not generate an object program. It must convert the program each time it is executed. Visual Basic also uses an interpreter.
An assembler is translating program that converts assembly language programs into machine language.
Difference between Compiler and Interpreter
Following is a brief difference between compiler and interpreter:
|The compiler converts a program into machine code as a whole||The interpreter converts the program into machine code statement by statement|
|The compiler creates an object code file||The interpreter does not create an object code file|
|A compiler converts a high-level program that can be executed many times||An interpreter converts a high-level program each time it is executed.|
|Programs execution is fast||Programs execution is slow|
|Compiler displays syntax errors after compiling the whole program||The interpreter displays syntax errors on each statement of the program.|
Relationship of Object Program, Source Program, and Compiler
A source program is written by a programmer in a programming language such as C. This program is not in a form that a computer can understand. A compiler translates the source program into the object program that the computer can understand and execute.