Monday, June 22, 2009

WHAT IS A COMPILER?

This is not a silly question. We were all beginners at one time and asked the same question. The following answer is provided for those that have no programming experience.
A computer cannot understand the spoken or written language that we humans use in our day to day conversations, and likewise, we cannot understand the binary language that the computer uses to do it's tasks. It is therefore necessary for us to write instructions in some specially defined language, in this case C, which we can understand, then have that very precise language converted into the very terse language that the computer can understand. This is the job of the compiler.
A C compiler is itself a computer program who's only job is to convert the C program from our form to a form the computer can read and execute. The computer prefers a string of 1's and 0's that mean very little to us, but can be very quickly and accurately understood by the computer. The original C program is called the "source code", and the resulting compiled code produced by the compiler is usually called an "object file".
One or more object files are combined with predefined libraries by a linker, sometimes called a binder, to produce the final complete file that can be executed by the computer. A library is a collection of pre-compiled "object code" that provides operations that are done repeatedly by many computer programs.
Any good compiler that you purchase will provide not only a compiler, but an editor, a debugger, a library, and a linker. Online documentation and help files are usually included, and many compilers have a tutorial to walk you through the steps of compiling, linking and executing your first program.

No comments:

Post a Comment