From the "Why are you doing that files?"

I have this habit of working on things that don't seem to have a lot of importance simply because I think it would be interesting. This decision almost inevitably leads to exteme frustration on my part, yet I seem to keep doing it.

My most recent decision? A math parser.

See, I want a stack screen calculator for my pocketpc...and it's been awhile since I wrote anything for the NETCF. So, seems like the thing to do. I basically need to create a parser than can evaluate an equation and return a result. I believe I understand how to do this (I looked up some documentation on how one might do this). You parse the equation into numbers and operators, starting with the inner most parentheses. The idea is that you evaluate the operators and numbers such that you can use RPN (reverse polish notation) to generate answers internally. My only problem is nested parentheses; I don't know how to handle them....unless I find the first set, sub-parse it and handle parentheses recursively....

and about then, my eyes start to cross.

Anyone worked on something like this before or can point me in the direction of how such a algorithm might be built?
Print | posted on Monday, May 19, 2008 9:13 AM

Feedback

# re: From the "Why are you doing that files?"

left by Jonathan Starr at 5/19/2008 11:53 AM Gravatar
Hey Theo. Sounds like an interesting side project.

I used Tamer Oz's code for parsing math expressions before. It should suit your needs IMHO... You can find his code @

http://www.codeproject.com/KB/cs/MathParserLibrary.aspx

Jonathan Starr

# re: From the "Why are you doing that files?"

left by Tracy at 5/20/2008 10:40 PM Gravatar
I have the opposite,... When a task became not very challanging, I leave working on it w/o completing...

# re: From the "Why are you doing that files?"

left by Lou at 5/23/2008 9:25 PM Gravatar
I'm just glad to see Theo working on .NET CF projects again :)
Comments have been closed on this topic.