C_03 Language translators | Compiler | Interpreter | Assembler | Programming in C

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
in the series of learning programming in c today i'm going to talk about language translators in the previous videos i have already discussed like what is neuro programming why do you write programs what is need of programming languages what are low level programming languages high level languages right now see in this video we are going to discuss 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 cc plus 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 so we are going to discuss all the types of language translators in this video but before that just want to tell you one thing this video is brought to you by unacademy because an academy is going to start a test series for all the gate aspirants 2021 named gate challenge and this test series is having four levels first three levels will be containing 30 question and the time would be 90 minutes and the final level would be it's like grand finale and it is containing 65 questions and 180 minutes time would be there so the final level or the final round would be it's like you are um taking that proper gate test gate exam and these tests has been designed by the best faculties at an academy and you can take the live test if you take the test live then all india ranking would be provided to you but there is only there is also a facility to write the test after the live test is over and it is going to be started from 19th of december from 19th to 22nd of december the detail is over here you can check out and the test would be in english so it's better to take the test because you will come to know where you are standing and how well you have prepared for your gate exam so if you are interested you can go for it all the details and the invitation code and the link for the series i'll provide you in the description box of this video you can go and check out now let us discuss language translators three translators are there first is assembler compiler interpreter assembler is what it is basically used to convert the program written in 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 right next comes to 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 now what does that mean see 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 machine code zeros and ones right and after that linking is done loading is done means after that executable file will be created and then you will run that executable file and you will get the output that also will discuss see compiler will work on which model translation linking loading three steps are there translation linking and loading that we will discuss in next video the complete process right but interpreter act upon interpretation model now what does that mean see same program i'm going to take and what interpreter will do 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 and or 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 only you will give data no first the complete program will be converted into object code exa file after that data will be taken to that exe file and then the program runs but here it takes line by line one line interpret that line convert it into object code and run it after that second line convert it into object code and run it means what it will convert the code the 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 so now what is so it is what it is not going to do some linking and loading but yeah it will do translation as well as linking and loading fine so now what are some advantages and drawbacks of this thing i hope you got the process how compiler works how interpreter works see here directly you will get output no object code so one more difference is what here object code would be created here no object or no separate file would be created for object code next difference is what it is slower why so because it is executing line by line it takes one line interpret it means convert it into object code and then run it then again take second line till then cpu will wait right then convert it into object code then run it but the time taken by the compiled program see it compile the complete code at one time right and then when it is going to execute so time to execute that compiled code is very less than this time so you can say interpreter is slower means it runs slower than the compiled code now next difference is what see when you will get errors after compiling the complete code at last here you will get list of errors or maybe warnings and with line numbers i hope you are familiar with this thing but here when you will get errors while running see it is taking one line line by line statement by statement and then converting it into object code and then run it but if any error is there in first line then it will stop here at the same time it will show you error and so debugging is easy in this case finding out errors is easy but here it is tough because first it it will give you list of errors after compiling after compiling the complete program then it will give you error so debugging is you can say comparatively uh tougher than this one here in compiler see here it's not like that the object code would be created means uh you would rather say if there is no error in your program then only it will be successfully compiled and then only it will create object code if error comes then you will have to get back to your source code you will have to correct those errors compiler is not going to correct your errors it just only show you the errors you will correct you will modify your program you will again save it you will again compile it and if there is no error then only it will uh generate object file then exe file and then the program can run right now next difference is what once successfully compiled the program once object code has been created then after linking and loading executable executable file will be created after that to run that file there is no need of this source code you can directly run that executable file again and again with different output different inputs and obviously according to that input you will get output no need of the source code but here you will need source code why so because here it takes one line only line by line statement by statement it scans the program statement by statement at one time means it takes one statement at one time so it will take this line interpret it means convert it into object code and run it then again to run the second statement obviously interpreter needs this source code right so every time it needs source code to run the program next difference is what it generate an intermediate code or you can say this object code so it need needs more memory to store this code but here no intermediate code no object code separate file for object code has been created so it requires less memory fine it directly execute the program you can also take a real life example uh to uh see the working of this thing see if suppose any russian delegation come to our country to meet our delegation like our pm suppose so and they speak russian language only they don't speak hindi or english so our pm is not able to understand russian so he needs what a translator whenever they speak like one language one line in russian language the translator will convert that line into hindi either hindi or english again he'll speak second line and the translator will convert in it into hindi or english right and then our pm is able to understand and when our pm speaks in hindi so they are not able to understand because their language is russian so their translator will convert whatever rpm uh say line by line to russian language so that is what it's a kind of interpreter right line by line but second case is what if suppose you are watching a russian movie so they have dubbed that movie suppose and they have given the those subtitles in english language so whenever you watch that movie every time no need of conversion from russian to english because you have already compiled that language compile that movie you have already subtitles that english subtype english subtitles so whenever you will watch you will get those subtitles no need to convert that movie again and again or line by line fine so that is what you can say example of compiler i hope you are able to relate these things fine so next difference is what the language which use interpreter is what or you can say interpreted languages are python ruby pearl and compiled languages are what c c plus plus c sharp these kind of languages right so if you want to show the working of these compiler interpreter in this diagrammatic form then you can write what here you can write source code compiler then object code or you can say machine code and then you will get output i am writing this short form this is output this is machine code and here this is what source code interpreter and directly you will get output no object code and machine code would be generated in a separate file right and here as i have already told you there is no need of compiler there is no need of source code once that object file has been created right then linking and loading will be done and then you can separately run that executable file so no need of this compiler to be present in memory while executing while running that program but here while executing the program interpreter needs to be in memory why so because it takes line by line the the convergence the conversion and the running of the program runs parallel here so it needs to present in memory at that time but no need of this compiler in memory while executing the program right so i think these are some differences between this compiler and interpreter i hope you got my point so that's it for this video in the next video we'll see that translation linking and loading process how programs means when you write a c program then how that program gets executed we will see the complete process so nice in the next video till then bye take care
Info
Channel: Jenny's lectures CS/IT NET&JRF
Views: 125,834
Rating: 4.9348426 out of 5
Keywords: data structure tutorials, operating system, data structure and algorithms, jayanti khatri lamba, jennys lectures, jenny data structures, jennys lectures DS, jenny lamba, jennys baby, jennys lectures baby, data structures, language translators, compiler, interpreter, assembler
Id: qcEBXrqFLe8
Channel Id: undefined
Length: 14min 10sec (850 seconds)
Published: Wed Dec 16 2020
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.