If you are going to parse anything other than a simple syntax structure, you should look at flex and bison...