Developer of ParseKit here.
First, note: TDArithmeticParser
is just some (not-terribly-robust) sample code included in the test bundle for ParseKit. It is not part of ParseKit itself.
Looks like this is a bug/deficiency in the TDArithmeticParser
class where -15
is recognized as negative fifteen, not subtract fifteen.
If you add whitespace, this issue is resolved:
s = @"10+(2*3)- 15";
The opposite behavior is also possible with a small change, but then a stand-alone -15
would not be recognized as valid input (which may or may not be a problem for you).
Both could be supported simultaneously with some changes to the Grammar and the Assembler callbacks.