Translating Our Source Code

Remember, computer only understand machine code. There are two way to translating programming language to machine code :

  • Compiling the source code
  • Interpreting the source code

Compiling

Compiling code means you have program called compiler that will translate your source code into different files contains machine code, the result is executable file (.exe).

Some languages that used compiler to translate their source code are C, C#, and Swift.

Interpreting

Interpreting code means you have program called interpreter that will processing the source code on the spot.Languages that using interpreter for example are Javascript, Ruby, and Phyton.

Difference

There are some different when compiling or interpreting source code :

Compiler Interpreter
Takes entire program as input Takes single instruction as input
Often faster Often slower
Source code not shared Source code is shared
Errors are displayed after entire program is checked Errors are displayed for every instruction interpreted (if any)
Have "ready to run" machine code Interpreter required on each computer

Intermediate Approach

you can use intermediate approach that combine these two, compiling into intermediate languange, that faster to interpreting

For example, Java using this method for their languange.

results matching ""

    No results matching ""