shell calculator with precedence handling