To run a program you've written, eg in JAVA, it must first be translated into machine code so the computer can read it. This is what compilers and interpreters do.
However, compilers convert the code all at once, save it, then run it; whereas interpreters translate the code one line at a time, as it is run.
Interpreters tend to result in faster translating of code so they are used mostly for debugging. This is because if you used a compiler, you'd have to re-compile your entire project every time you changed one little thing.
However, it's not very efficient to keep re-translating your code once you've finished writing it, because it would waste CPU time. Because of this, once code is done, it is normally compiled so that it runs faster and takes up less space. Another advantage of this is that your code is then much harder to copy without lengthy 'reverse engineering.'
Answered by
Ashish Yadav
, an ibibo Wizard,
at
2:50 PM on November 27, 2008