Compiler

Compilation process

Let’s consider how the compiler works, step by step. Let’s suppose that we wrote a program. We saved its source code to a file on the hard disk. Then, we ran a compiler that fits the language we used.

Each programming language has a corresponding compiler or interpreter. The compiler reads our file, processes it, and writes the resulting machine code in the executable file on a disk. Now, we have two files: one with the source code, and one with the machine code. Every time we change the source code file, we should generate the new executable file. We can run the executable file to launch our program.

The figure below shows how the compiler handles a program written in C or C++.

Get hands-on with 1200+ tech skills courses.