look at PPExpressionParser class.

it's designed for that and you have a great example in the class comment

2013/1/28 Hilaire Fernandes <hilaire.fernandes@gmail.com>
Hello

I try to extent the example of the arithmetic evaluator[1], I don't
understand the magic underneath nor how you will make it works with
substraction.

Changing method add to:

add
�^ prod, ($+ asParser / $- asParser) trim, term


to parse mixture addition and substraction is wrong:

parser parse: '1 - 2 + 6' �-> #(1 $- #(2 $+ 6))


The precedence is wrong.

How will you make it work? It seems to me the way to handle precedence
in the example is not suited for extension

Thanks

Hilaire



[1] http://pharobooks.gforge.inria.fr/PharoByExampleTwo-Eng/latest/





--
Guillaume Larcheveque