I need to generate a Grammar and then a parse tree and then finally evaluate that parse tree...but i dont know where to start and how to code.
If this is done as part of some course you should know what to do but if not you could try a Recursive Descent Parser. It's simple and straightfoward so there are plenty of resources on the net you can look for. Here's one,
You start by developing the grammar making sure it's LL(1). Then the actual parser follows almost automatically from the grammar.
For the evaluation you have two options. Either evaluate immediately during parsing or generate a parse tree which is evaluated afterwards. It's virtually the same because the recursive parsing process will walk through an implicit parse tree. It's your choise whether you evaluate by making it explicit or not.
Last edited by nuzzle; September 14th, 2012 at 03:46 AM.