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