in reply to
Using overload to parse arithmetic terms
If you want to output a properly parenthesized mathematical expression, you'll have to do so on the fly, examining the tree that I assume you have in your Arithmetic object. For example, if you have $x = ($a + $b) * $c;, then you probably have a tree like:
When you're walking that tree, when you get to a Multiply or Divide node, you have to check to see if its children are Add or Subtract nodes; if they are, those child nodes need to be surrounded by parentheses when output.