I can recommend the book „Compilers: Principles, Techniques and Tools“ [often called „Dragon Book“]. It explains from the basics with all the theory how to write a Leser, parser and much more features. It is one of the few books I bought after university.