evaluateExpression function
Evaluates the small arithmetic language the calc action uses.
Supports + - * /, parentheses, decimals and unary minus. Nothing else:
this exists so a generated calculator can compute 12+7*2, not so a model
can run code. Anything it does not understand is a ProtocolException,
never a silent wrong number.
Implementation
double evaluateExpression(String input) {
final tokens = _tokenise(input);
final parser = _Parser(tokens, input);
final value = parser.parseExpression();
parser.expectEnd();
return value;
}