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 aCprogram calledhello.c, we include system header files, for example,stdio.h.
In this phase, The preprocessor, modifies the originCprogram 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.hinto the program text, generate the resulthello.ifile, it's anotherCprogram.
- Compile
In this phase, Complile translateshello.iintohello.s, it's a assembly-language program. - Assemble
In this phase, Assembler translateshello.sinto 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.owithprintf.o, and generates the result ofhellofile, which is an executable object file.