Language translator is software that translates instructions written in assembly or high-level language into machine language. The translator is required because the program is written in high-level language for the convenience of the programmer which is not directly understood by the computer.
Assemblers
Assembler is a translator who translates a program written in assembly language into a machine-level language where assembly language is nothing more than the symbolic representation of machine code.
Function of assembler
- It translates mnemonics codes into machine codes
- It allows the programmer to use mnemonics while writing source code programs, which are easier to read and follow.
Compiler
The compiler is a language translator that translates programs written in a high-level language into a set of machine language instructions at once. A compiler can translate only those programs for which it is designed. C compiler is only capable of translating source programs that have been written in C and, therefore each machine requires a separate compiler for each high-level language that it supports. compiler scans the entire program first and then translates it into machine code.
Features
- It translates the whole source program written in High-level language
- It takes less time for translation.
- Useful for both small and large programs
- It converts source code directly into object code.
Interpreter
It is also a language translator which translates programs written in a high-level language into a machine code line by line. Each time program is executed, every line is checked for error and then converted into machine code so more execution time is required.
Features
- It translates each line of source code in succession without looking at the entire program.
- It required you to translate the program each time you want to run the program.
- useful for adding small sections of a program at a time and testing them quickly.
- interpreted program runs slower than the compiled program.
- It does not generate an object program.
Programming Language :
i) Machine language: It is a language that is made of 0’s and 1’s.Machine language is the only language a computer is capable of understanding. The exact machine language for a program or action can differ by the operating system.
II) Assembly Languages: In assembly language, all (0 and 1) are replaced by letters, words, etc. In assembly language, we use one in place of operation code. Ex: Add a,b; sub a,b
iii) High-Level Language: In a high-level language, we use letters, words, special symbols, and operations.Ex int a,b
C=a+b