Interpreter
A C++ class capable of interpreting algebraic expressions
Usage example for x squared expression:
art::Interpreter xSquaredFunction("x*x");
int result = xSquaredFunction.getResult(2);
result = 4
Usage example for a+b*(5*a), where a = 2 and b = 4:
art::Interpreter function("a+b*4");
int result = function.getResult({2,6});
result = 42
Limitation
- The interpreter can parse these operators: +, -, *, /, ^
- The interpreter does respect parenthesis priority
- The interpreter does not support sqrt(), sin(), tan(), cos() etc...