There are many books, masters theses, and articles on this science. It is a much too elaborate and complex subject to discuss in the limitations of this web forum, in my opinion.
Have you gone to the library or searched online? Have you gone to sourceforge.net (for example) where there are freeware/shareware compilers (with their source code) availabel for download and studied them?