Development (General)

Compiler vs interpreter: what's the difference?

Compiler vs interpreter: how each turns source code into a running program, why compiled code usually runs faster, when errors show up, and where JIT fits.

  • 7 min read
  • 5 questions
  • +35 XP
Transcript

Compiler versus interpreter explained by cats. Kitty writes code. With a compiler, the whole code is translated first, all at once into machine language. If there's an error, the compiler stops. Kitty must fix the code, then recompile. Once it works, the program runs fast.

With an interpreter, Kitty's code is read line by line. Each line is translated, then run immediately. If there's an error, execution stops at that point. Kitty can fix it and run again without recompiling the whole program. But every run is slower because translation happens each time.

So, compiler translates everything first, then run fast on each execution. But an interpreter translates and runs the code line by line. Flexible but slower. Both turn Kitty's code into actions, just different trade -offs.