eval() function for Arduino?
TinyExpr does what you want, and more.

TinyExpr is a very small recursive descent parser and evaluation engine for math expressions. It's handy when you want to add the ability to evaluation math expressions at runtime without adding a bunch of cruft to you project.
In addition to the standard math operators and precedence, TinyExpr also supports the standard C math functions and runtime binding of variables.

Your example
You'd just need to save tinyexpr.h and tinyexpr.c next to your Sketch.
#include &quot;tinyexpr.h&quot;

void setup() {
  Serial.begin(115200);
}

void loop() {
  char term[] = &quot;12 + (2 * 5)&quot;;
  Serial.println(term);
  int error;
  double result = te_interp(term, &amp;error);
  if (error){
    Serial.println(&quot;Problem with expression.&quot;);
  } else {
    Serial.printf(&quot; = %.10g\n&quot;, result);
  }
  delay(1000);
}

It outputs:
12 + (2 * 5)
 = 22

Since term is known at compile-time, this example is not very useful, and it simply outputs 22 in an endless loop.
Basic interactive console
If you use the input from Serial, you can write a very basic interactive console. A String has been used for conciseness, but this example could be rewritten with cstrings:
#include &quot;tinyexpr.h&quot;

void setup() {
  Serial.begin(115200);
}

void loop() {
  if (Serial.available() &gt; 0) {
    String expression = Serial.readStringUntil('\n');
    Serial.print(&quot;&gt; &quot;);
    Serial.println(expression);

    int error;
    double result = te_interp(expression.c_str(), &amp;error);

    if (error) {
      Serial.print(&quot; &quot;);
      for (int i = 0; i &lt; error; i++) {
        Serial.print(&quot; &quot;);
      }
      Serial.println(&quot;↑&quot;);
      Serial.println(&quot;I didn't understand this part.&quot;);
    } else {
      Serial.printf(&quot; = %.10g\n&quot;, result);
    }
  }

  delay(50);
}

TinyExpr knows the order of operations, and it understands many other mathematical expressions:
&gt; 12 + 2 * 5
 = 22
&gt; 3^5
 = 243
&gt; exp(7)
 = 1096.633158
&gt; (1 + sqrt(5)) / 2
 = 1.618033989
&gt; 1 + 2 * 3 + 4 * 5
 = 27
&gt; sin(pi/2)
 = 1
&gt; sin(pi/3)
 = 0.8660254038

If there's a syntax error somewhere, error tells you the position of the first encountered error:
&gt; 3 + 
      ↑
I didn't understand this part.
&gt; sin() * 5
      ↑
I didn't understand this part.
&gt; 3 / (4 + 5 * 7
                ↑
I didn't understand this part.