Skip to content
BENIBIX Learn

Compiler

Development⚙️ Compilers & RuntimesCompilation

A tool that turns all your code into one file you can run.

Think of it like

Think of it like turning a whole book into French first. Then French readers get the done copy.

Example

Jack compiles a C file of 5 lines. Out comes a program file of about 16,000 bytes that runs with no compiler around.

Why it matters

Compiled programs start fast and run fast. Many mistakes are caught before anyone runs the code.

Definition

A compiler is a program that turns source code into a form the computer can run directly. It reads the whole program first and checks it for errors. Then it writes out a new file, often machine code, that runs on its own. The original code is not needed to run it after that. C, C++, Rust and Go use compilers.

Example code

console
$ gcc hi.c -o hi
$ ./hi
Hi
gcc turns hi.c into a program called hi, which then runs on its own.

Common mistake

Thinking that code which builds is right. The compiler checks the grammar, not the logic.

Key takeaways

  1. 1
    Whole program first. It reads everything before making output.
  2. 2
    New file out. The result runs without the source.
  3. 3
    Errors up front. Grammar slips stop the build.

Learn it properly