ArthoPacini / Interpreter

C++ class capable of interpreting algebraic expressions

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

  1. The interpreter can parse these operators: +, -, *, /, ^
  2. The interpreter does respect parenthesis priority
  3. The interpreter does not support sqrt(), sin(), tan(), cos() etc...

About

C++ class capable of interpreting algebraic expressions

License:MIT License


Languages

Language:C++ 99.4%Language:Makefile 0.6%