Translator is a software program that converts source code (English or human readable and understandable ) into object code(0,1 or binary or machine code or computer understandable), so that computer can understand and perform task. i.e As translators name implies these convert one type to another.Any high level programming language uses translators.
Translators check all syntax and semantics of programming language then convert into object code.if any error founds in program then tells what is error in program by error message.
For example:- if we use any library function and respective header file is not included then prototype error message is generated by compiler.
There are three types of translators in programming language.
- Assembler:- it’s a type of translator that converts assembly language in to machine language. i.e Assembler converts assembly language to machine language. it was used in second generation(1950-1958) language. Assembly language looks like small words of English example : ADD, SUB, MULTI etc.
- Compiler:- it’s a type of translator that reads entire program at a time and converts into machine language. it is very fast compare to interpreter.. In case of error it indicates error in entire program. it is not user friendly. it used in high level language i.e third and fourth generation language. for example C, C++ language use compiler as a translator to converts into machine language.
- Interpreter:- it”s a type of translator that reads one line at a time and converts into machine language. it is slow compare to compiler. In case of error it indicates error in particular line. python, Ruby, Basic use interpreter as translators. Every language uses any one translator. but java language uses both compiler and interpreter.
Source code:- codes or instructions written by programmer using any programming language known as source code. it is human readable and understandable.
Computer science XII VVI program
Object code :- codes or instructions in binary (0,1) or machine code is called object code. it is computer’s understandable.