Compiled Languages

  • Compiled languages are translated into machine code before execution
  • The source code is converted into an executable file optimised for the specific hardware and operating system of the target machine
  • They tend to be faster and more efficient than interpreted languages since the code is already translated into machine code before execution
  • Compiled code is less portable as it is specific to the machine it was compiled on
  • Ex: C, C++, Java, and Swift

Interpreted Languages

  • Interpreted languages execute source code directly through an interpreter without prior compilation into machine code
  • The interpreter reads the source code line by line and translates it into machine code at runtime
  • Interpreted languages are more flexible, offer features like dynamic typing, and have smaller program sizes.
  • They are also more portable as the same source code can run on different hardware and operating systems without recompilation.
  • However, interpreted code tends to be slower than compiled code since it is translated at runtime
  • Ex: Python, Ruby, and JavaScript