From a high level view, the compilation process is something like this:

1. Lex the source (i.e. find tokens, identifiers, keywords, constants)

2. Parse (make sure the program's syntax is correct)

3. From there many many phases can exist, such as symbol table building (to find variables that are used but not yet declared)

At this point the source code is in an Abstract Syntax Tree (AST) or some other intermediate language. It can go through many phases of intermediate languages, but basically its purpose is to provide a way to do optimizations and other things.

Once it does that, it would usually generate some type of assembly file, then the linker would link in library code. Then the actual binary would be generated.

 

*Disclaimer* I probably left out quite a bit. I typed this up pretty quickly. Someone else can chime in and fill in the blanks.

Compilers are the way of the future, especially with managed languages, and dual core processors. The hardware will rely more and more on software techniques to realize performance.