HomeToolsAbout a20k

Compiled vs Interpreted vs Transpiled

Compiled vs Interpreted

Compiled langauges are translated directly into machine code that the processor can execute.

Interpreted languages are translated into machine code line-by-line as the interpreter program (written in the language of the native machine) is run.

You can do everything in an interpreted language that you can do in a compiled language as both are Turing Complete.

Advantages of Compiled Languages

Faster performance by directly using the native code of the target machine.

Opportunity to apply powerful optimization during compile stage.

Advantages of Interpreted Languages

Easier to implement, debug, and test.

No need to compile, can execute code directly on the fly.

Compiler vs Interpreter

Compiler is a program that tanslates the human-readable code to a language a computer processor can understand (binary 1s and 0s) before the program is run.

  • Compiler must comply with the syntax rule of the programming language, otherwise it will not compile

Interpreter also translates high level code to lower level machine code, but it executes the conversion when the program is run.

# compiler source code -> compiler -> machine code -> output # interpreter source code -> interpreter -> output

Compiler vs Transpiler

Compiler translates code from higher level language to lower level language.

Transpiler translates code from same level of abstraction

  • e.g. Babel (ES6+ to ES5)
© VincentVanKoh