I remember asking this question about seven years ago when I was rather new to programming.
I was very careful when I asked and surprisingly I didn't get as much criticism as you are getting here. They did however point me in the direction of the "Dragon Book" which is in my opinion, a really great book that explains everything you need to know to write a compiler (you will of course have to master a language or two. The more languages you know, the merrier.).
And yes, many people say reading that book is crazy and you won't learn anything from it, but I disagree completely with that.
Many people also say that writing compilers is stupid and pointless. Well, there are a number of reasons why compiler development are useful:
- Because it's fun.
- It's educational, when learning how to write compilers you will learn a lot about computer science and other techniques that are useful when writing other applications.
- If nobody wrote compilers the existing languages wouldn't get any better.
I didn't write my own compiler right away, but after asking I knew where to start. And now, after learning many different languages and reading the Dragon Book, writing isn't that much of a problem. (I'm also studying computer engineering atm, but most of what I know about programming is self taught.)
In conclusion, The Dragon Book is a great "tutorial". But spend some time mastering a language or two before attempting to write a compiler. Don't expect to be a compiler guru within the next decade or so though.
The book is also good if you want to learn how to write parsers/interpreters.