Assuming you want to know this to make your own programming language...
Step one is to learn about BNF grammers.
When I was in school we used a book called Princples of Compiler Design. I felt this was an excellent bok at the time. It taught me a lot about how toprogram well.