The standard answer to embedding source code listings in a LaTeX document is the listings package. It works in pure LaTeX, by parsing the source code and highlighting some parts of them.

An alternative I just found on Stack Overflow is the minted package, created by Konrad Rudolph. It uses the Pygments library to do the actual parsing and highlighting.

I did not yet try the package, but I will and then update this post for my experiences.