Language Processors
Language Processors
We know that computer understands instructions in machine code, i.e. in the form of 0s and 1s. It is difficult for us to write computer program directly in machine code. The programs are written mostly in high-level languages, i.e. BASIC, C++, Python etc. A program written in any high-level programming language (or written in assembly language) is called the Source Program or Source Code.
The source code cannot be executed directly by the computer. The source code must be converted into machine language to be executed. The program translated into machine code is known as Object Program or Object code.
The special translator system software that is used to translate the program written in high-level language (or Assembly language) into machine code is called language processor or translator program.
The language processors can be any of the following three types- Assembler, Compiler and Interpreter.
Assembler
The Assembler is used to translate the program written in Assembly language into machine code. The input of Assembler is a source program that contains assembly language instructions. The output generated by assembler is the object code or machine code understandable by the computer.
Compiler
The language processor that translates the complete source program as a whole in one go into machine code is called compiler. Some of the examples are C and C++ compilers.
The program translated into machine code is called the object program. The source code is translated to object code successfully if it is free of errors. If there are any errors in the source code, the compiler specifies the errors at the end of compilation with line numbers. The errors must be removed before the compiler can successfully recompile the source code again.
Interpreter
The language processor that translates a single statement of source program into machine code and executes it immediately before moving on to the next line is called an Interpreter. If there is an error in the statement the interpreter terminates its translating process at that statement and displays an error message.
Only after removal of the error, the interpreter moves on to the next line for execution.