I’m searching for a simple way to evaluate a simple math expression from an string, like this:
3*2+4*1+(4+9)*6
I just want + and * operations plus ( and ) signs. And * has more priority than +.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
I think you’re looking for a simple recursive descent parser.
Here’s a very simple example: