add preprosessing to add necessary parentheses for standard algebraic