Many CS undergrads have a compilers class or section of a class for a single semester in either the freshman or sophomore year. Compilers for simple languages like C (simple in an objective sense, mind you) are easy once you understand a few basic concepts. Compilers in general are fairly easy, what's hard is optimization. See for instance this division optimization:
http://ridiculousfish.com/blog/posts/labor-of-division-episo... That's just one clever trick, imagine going through a similar amount of work for dozens of different tricks.