Compilation

Q: What exactly do you mean by “compile”.

A: “Compile” means “translate”. A compiler is a program that translates your program, written in a high-level programming language such as C, into a form which the computer can understand, i.e. in the machine code for that particular computer.

Machine code

For instance, the command to clear the “carry” bit (i.e. the binary “carry” digit — 0 or 1 — resulting from an addition or subtraction) in the instruction set of an Intel Pentium processor is the 1-byte binary number “11111000”. The command to add a 1-byte number n to the number in the “accumulator” register is “00000100”, followed by binary number n. It would be very time-consuming and tedious to have to write our programs in the machine language of particular processor. Furthermore, machine language programs written for one kind of processor will not run on another. Consequently, we write programs using high-level programming languages, which we then automatically translate into the machine language of the particular processor using a compiler program.

Our C program is the same whatever machine we might run it on, but in order to be understood by a particular computer it has to be translated into a form that that computer understands. So an SGI workstation will need one C compiler, on a PC it will be a different one, on a Mac it will be a different one yet again, because they are different machines with different processor chips with different machine languages. If you don’t have a compiler that is the right compiler for your machine then you can’t compile the code, so you can’t run the program. This website includes a download link to the GNU C compiler, gcc, in particular a version called DJGPP that runs on PC’s, in order to generate executable programs (.exe files).