It's a mistake to write your own parser because they can get so complex so quickly to even do basic stuff, and you'll lose sight of the original goal of the project. See Prolog - a whole programming language built around the idea of parsing language (albeit NLP)!
I suggest you take alook at Antrl4 for a powerful but easy to use parser plus lexer combo.