Information is Bits + Context
Machines only know bits, either 0
or 1
.
Context tells us what do the bits mean. We can distinguish a bunch of bits only when we put them into some context. A String of the same bunch of bits in different contexts can have different meanings.
Programs Are Translated by Other Programs into Different Forms
Basically, we have four steps to translate our program into an executable object program that the system can run.
- Preprocessing phase(
iso
)
When we write aC
program calledhello.c
, we include system header files, for example,stdio.h
.
In this phase, The preprocessor, modifies the originC
program according to directives that begin with#
character:
-
#include <stdio.h>
command tells the preprocessor to read the content ofstdio.h
- insert the content of
stdio.h
into the program text, generate the resulthello.i
file, it's anotherC
program.
- Compile
In this phase, Complile translateshello.i
intohello.s
, it's a assembly-language program. - Assemble
In this phase, Assembler translateshello.s
into machine language instructions, then packages them and stores the result intohello.o
, it is a binary file whose bytes encode machine language but not characters anymore. - Link
In this phase, Linker mergeshello.o
withprintf.o
, and generates the result ofhello
file, which is an executable object file.