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

php - Invalid Cofiguration - yii\base\InvalidConfigException - Yii2 -

How to show in django cms breadcrumbs full path? -

ruby on rails - npm error: tunneling socket could not be established, cause=connect ETIMEDOUT -