I wonder what is compiling, what happens when you compile? I mean yes you press compile or type in in the console but what does it actually do in the \"background\"?
A very brief overfiew would be a compiler parses your code checking for errors and then transforms it into byte or machine code.
For a better overview I would read the wikipedia article on compilers:
http://en.wikipedia.org/wiki/Compiler
Compiling is translating source code to machine code. Usually a compiler (or interpreter) will generate an intermediate code sometimes called byte code which runs on a virtual machine (this is how java is compiled). The byte code is translated by the vm to machine specific code thats runs on the particular architecture you are targeting. This whole process can be considered "compiling"
First, the compiler "lexes" the source. This means that it transforms the source into a sequence of "tokens." Tokens are sequences of letters, numbers and symbols that have meaning to the compiler.
Next, the compiler "parses" the sequence of tokens from step one. This means that the compiler checks to ensure that the source conforms to rules (the grammar) of the programming language.
Next, the compiler performs syntactic analysis to create a representation of the source to determine the semantical meaning of the source. This is the step where the compiler will build a syntax tree.
Finally, the compiler will generate output that captures the semantic meaning of the source in the target representation (be it machine code, an intermediate language such as Microsoft's CIL, or another programming language).
For the brief details see Wikipedia. For the gory details see the dragon book (every student of computer science should study this book).
See this
Basically, magic elves and fairies turn human readable code into machine code.
Or this.
The Dragon Book, the original source for building compilers.