parsing - Smart design of a math parser? -


what smartest way design math parser? mean function takes math string (like: "2 + 3 / 2 + (2 * 5)") , returns calculated value? did write 1 in vb6 ages ago ended being way bloated , not portable (or smart matter...). general ideas, psuedo code or real code appreciated.

a pretty approach involve 2 steps. first step involves converting expression infix postfix (e.g. via dijkstra's shunting yard) notation. once that's done, it's pretty trivial write postfix evaluator.


Comments

Popular posts from this blog

html - Difficulties with background-image property -

visual studio code - What does the isShellCommand property actually do and how should you use it? -

ios - Segue not passing data between ViewControllers -