The compiler is a software program that transforms a program or code written in high-level programming language into a low-level machine.
Language translators now why do we need language translators what are language translators see language of computer is what binary language computer can only understand zeros and ones so if you write code in machine language that is okay that is zeros and ones form so computer can directly execute that program but if you write program in assembly language or high level language like c, C Plus ,java c sharp javascript then those programs have to be converted into object code object code means machine code zeros and ones because computer cannot understand assembly language or that high level language because generally we write program in english language english means in assembly language we use what mnemonics like for addition.
We write add a double d for subtraction we write sub but computer cannot understand these words these mnemonics so you have to convert those mnemonics into machine code into zeros and ones and that's exactly language translators do right.
Generally, there are three types of translator
compilers.
interpreters.
assemblers.
Assembly language into machine code or object code assembler is specifically to convert a program which is written in assembly language right and machine code means zeros and ones so you can say assembler is a computer program which is going to convert the program written in assembly language into machine code or object code .
For high level languages for converting high level languages into machine code two uh translators are there compiler and interpreter so let us see the difference between these two see you must have heard about compiler and you are using compiler also when you are writing program in c language you compile that program then you run that program and you get the output right so now let us see the difference.
Both are used what to convert high level language program into machine code machine code means zeros and ones form see both will convert high level language program into machine code so what is the difference compiler converts it before the execution of the program and interpreter converts while the program is executing while the program is running.
suppose you have written a program in c language right then suppose this is a program you have written this program and the suppose name is what first dot c compiler will take this program complete one all the statements written in this program right maybe 10 100 statements how many statements are written all the statements it will take and convert it into object code.
Interpreter will take one statement line by line it is not going to take the complete code as compilers too it takes first line first of all right change it into some intermediate code.
you can say that object code and at the same time give you output at the same time it will run this statement you can say in simple words it will run the statement converted then run it statement by statement right so while converting interpreter also takes you can say data if data is required to convert data is required to run a program and in this case it's not like that here.
High level language code into object code while the program is running means the execution of the program and the conversion and the trans translation runs parallelly but here translations are done before the execution it's not a parallel process that is the main difference.