String Expression Calculator

Parsing of math equations from text expressions is the interesting thing. This task is close to LL parsing but can be solved in different ways. This approach tends to be the simplest one.
From time to time some of your customers might ask you to extend current functions of your system with ability to specify some simple math formulas. This is tricky challenge if you have no relevant experience. Well, omitting all that theoretical things and go further. The code below could help you calculate simple math formulas with braces. Take a look at the screen-shot to get what I mean:

Below you can find that evaluator which can be simply integrated into your code. Have a look at the usage sample below:

And the evaluator source code:


No Comments

You can leave the first : )

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.