Let's start with the first one, the interpreter. With an interpreter what we do is we translate and read the files line by line on the flight. Let's have a look at how this works.
I have a piece of code here, I have a function that does some calculation and we just loop over this calculation, which is five plus four right over here. And we do that a thousand times. That's a long time and you see that we get the result nine over here, but the loop is happening over and over.
Well, a compiler like an interpreter doesn't translate on the fly. What it does is it works ahead of time to create a translation of what code we've just written. And it compiles down to usually a language that can be understood by our machines.
Let's have a look at the above code in more detail with a compiler.
If we interpret it this language that is going line by line one at a time and running it, it's going to create the same results as our previous language, so Compiler tries to understand what we want to do and takes our language and changes it into something else and this usually happens into something called a lower level language, such as machine code.Now, I know you're still a little bit confused.
You see, the definition itself is actually a little bit fuzzy in some respects, all languages have to be interpreted and compiled because it has to run.
In the next part going to explore that and say what JIT really is ...
You can read the next part from here