The difference between Interpreter and Compile programing language

What is the difference between interpreter and compiled programming language

Section 1: Explaining compiled programming language

Compiled programming language basically means that the code that is human readable will be transfered to machine code which is not easily readable by a human

Here are some example of compiled programming language

  • C++
  • C
  • Go (Golang)
  • Rust
  • Zig

Here is an example of a Rust hello world program


fn main() {
    println!("Hello World!");
}
                        

And here it is in binary (please scoll to the left for more)


01100110 01101110 00100000 01101101 01100001 01101001 01101110 00101000 00101001 00100000 01111011 00001101 00001010 00100000 00100000 00100000 00100000 01110000 01110010 01101001 01101110 01110100 01101100 01101110 00100001 00101000 00100010 01001000 01100101 01101100 01101100 01101111 00100000 01010111 01101111 01110010 01101100 01100100 00100001 00100010 00101001 00111011 00001101 00001010 01111101
                        

Please not that it is just the text transfered to binary, the program is not transfered to binary

As you can see, Rust (a human readable programming language) is easier to read, because it was made for human to read.

The compiling process may take a little long, depending on how long your code, and the programming language. However, after your code is fully compiled, it will run at a faster speed that interpreter programming language

Section 2: How programming language compile

Looking at the table below, you can get some information about the programming language

Criteria C C++ Golang Rust Zig Nim
Multiplatform
Small compilertcc ~620KB~200MB g++142MB414.1MB42.3MB tar.xz11.4MB tar.xz
Compiler speedFastSlowFastSlowMediumMedium
MaturityHighHighHighHighMediumHigh?
Binary sizeSmallSmallMediumSmallSmallMedium/Low?
System libraries dependenciesLowLowLowLowLow, small std libOpenSSL
Manual Memory managementYesYesYes, but good GCYesYesYes, stdlib needs GC
Syntax ModernityLowMediumMediumMediumMediumHigh
Syntax FamiliarityC (easy, macros make it hard)C-like (medium?, templates can be hard)C-like (easy)C-like (steep learning curve)C-like (medium learning curve)Python-Pascal-like? (easy?)

As you can see, different programming language have different compiler size, compiler speed, binary size, etc

I will take Rust for example, it have the biggest compiler size, the slowest compiler speed, but the binary size is reasonably small, and it is FAST

Go on the other hand, it have a fast compile speed, the binary size is reasonably small, but it is not as fast as Rust

Go on the other hand, it have a fast compile speed, the binary size is reasonably small, but it is not as fast as Rust

Mastering JavaScript

JavaScript is the foundation of modern web development. Understanding its core concepts is crucial for any developer.

Key Concepts

  • Closures
  • Prototypes
  • Async/Await
  • Event Loop
  • ES6+ Features

Example of Async/Await:


async function fetchData() {
  try {
    const response = await fetch('https://api.example.com/data');
    const data = await response.json();
    console.log(data);
  } catch (error) {
    console.error('Error:', error);
  }
}