Compiled vs Interpreted Programming Language

By right, an Operating System can execute specific file types, usually written in machine codes, which is readable. For instance, in Windows, they are .exe, or .bin files in Linux.

1. Compiled programming language

Compiled languages are written in files that will be translated directly into machine codes by a program (a.k.a. runtime) called "Compiler". Thanks to which the OS can understand and execute the translated files.

I think following is a comprehensive example: you guys write program with C++ in Visual Studio, then press F5 and boom... your program will run.

In this circumstance, C++ is a compiled language, Visual Studio is the compiler and Windows is the OS; such brief progress is as below:

  1. Write C++ codes in Visual Studio and press F5
  2. Visual Studio then translates .cpp and .h files into .dll and .exe .
  3. Windows will be able to execute .dll and .exe for you.

Got it guys? Well then, all other languages have similar feature as C++ are compiled languages:

  • Arduino codes in .ino , .c , .cpp files must be translated to machine codes and upload to main board.
  • Swift, a glorious product by Apple Inc. is another example for this type. Swift is promised to possess the "god like" executing speed in iOS or MacOSX because it is translated to machine codes.
In short, though restricted to platforms, they are lightning fast.

ezgif-2799872227.

2. Interpreted programming language

Those kinds, unlike compiled languages, are not translated to machine codes. They, instead, are translated to a middle code files and executed by another program so called "Interpreter"; and Interpreters are of course run on Operating system.

OK, let's take example. Java is a famous language for they can run on every platform (people say so, I know so too ha ha). When you write Java with Netbean on Linux and press F5... again your program runs. So in this case, Java is an interpreted language, Netbean is the compiler and Linux is the OS and the... er? Where is our interpreter?

Yeap, there must be, just not mentioned.

  1. Write Java codes,
  2. Netbean translates .java files into .class ones. Those files store Java byte codes.
  3. Java byte codes are executed by JVM (Java virtual machine). Oh yes! JVM is the interpreter.
  4. And last fact, JVM runs on Linux

Besides, there are more interpreted languages:

  • C#, the famous boy saves his codes in .cs files and then .NET engine executes on Windows.
  • T-SQL and PL/SQL are executed by SQL engine on many different platforms after being compiled (to other codes that I don't know).

Not always, but usually, interpreted languages are high-level, easily read, comprehensive and cross-platform compatible. They are, however, slow.

13239387_627778780710111_1087591906079524743_n


External references:

p.s. Compiling or interpreting are relatively accurate concepts, this highly depends on the producers who created them. Yet in some special aspects, a specific language may belong to both groups. My article is somewhat strict and one-sided view just because I wanted to help you understand. Who knows in next 50 years, 2 categorization will be obsolete?