compiler vs interpreter

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
[Music] hello there today we are going to learn about the main differences between a compiler and an interpreter so at first you should know that both compiler and interpreter are program used for translation each one of them do their job using its own way and this is what we are going to see in this video before we start you should know about two important terminologies which will be used later those terms are high level language and low level language if you already know what those terms mean you can skip to the minute shown on the screen [Music] unfortunately computers can just understand binary which refers to zeros and ones the fancy word for binary is machine language which is considered one of the low level languages because it's closer to the understanding of the computer than to humans because it's almost impossible for the human to write code that the computer using only zeros and ones other intermediate languages are born nowadays the languages that the human uses to write code are pretty close to english and some examples of that are python c and java and those are called high-level languages because they are closer to the understanding of humans than to the computer but you may have recognized that there is still a problem the computer can just understand the low-level languages but the human is providing high-level languages how can that be solved for that purpose we need a translator to do that job exactly it's here where compiler and the interpreter are used now after this little journey let us go back to where we started so as we mentioned earlier both compiler and interpreter work as translators from high-level language to a low-level language let's now see how each one of them do is the compiler takes the entire program you wrote in a high-level language and translates the whole of it into machine code at once after this process an executable file will be ready to run the translation takes some times to be done but after that execution is so fast unfortunately any error in the program will fully stop it from working errors will be displayed at the end of the compilation the interpreter takes each single instruction of the code translate it then execute it on its own the translation step before the program runs is fast because the program will start immediately but execution will run slowly the great thing about interpreters is that the program will fully execute until an error occurs errors will be displayed after each instruction that contains it let's see now real examples of compilers and interpreters in the first example we are going to see the intermediate executable file that the compiler creates for this example we have a c language program and we will try to compile it and see what will happen [Music] as you can see the compiler has created an intermediate object file test [Applause] this file has the extension.exe which means it is an executable file in this example we are using python 3.9 interpreter and we want to create a program file and see what will happen [Music] as you can see a test file is created without any additional intermediate files and these files has the extension.ui which means it's directly opened by the interpreter [Music] for the other example we will see how the errors are displayed which will clarify the way of working we mentioned earlier we are using here the new compiler online which do both compiling and execution in one step to make it easy use the printf function which displays on the screen what's written between the double quotation let us make an error and see the output as you can see the compilation stopped due to the error and no output is displayed [Music] in this case we are using the bash interpreter and this echo function is the same as printf let us make an error and see the output in this case you can see that the interpreter executed the first statement and gives an error for the second which clarify how the interpreters work after this long journey let's see this table that summarizes everything we mentioned take your time and read it if you find this video helpful please don't forget to leave a like a comment and a subscribe to see every video we upload in the near future and as always thanks for watching you
Info
Channel: Light
Views: 1,930
Rating: 4.9705882 out of 5
Keywords:
Id: 3iLUls6Z_tw
Channel Id: undefined
Length: 6min 22sec (382 seconds)
Published: Sat Mar 27 2021
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.