Why not use NSExpression?
http://nshipster.com/nsexpression/
UPDATE:
You will need something like this
int a = 1, b = 2;
NSExpression *expression = [NSExpression expressionWithFormat:@"%i + 4 - (3 * %i)", a, b];
id value = [expression expressionValueWithObject:nil context:nil];
UPDATE2:
Unable to use <, >, ==, !=, >=, <=in NSExpression. But you can use NSPredicate
int a = 1, b = 2;
NSPredicate *predicate = [NSPredicate predicateWithFormat:@"%i > %i", a, b];
BOOL result = [predicate evaluateWithObject:nil];
source
share