#include <iostream>
#include "uCalc.h"

using namespace std;
using namespace uCalcSoftware;

int main() {
   uCalc uc;
   // Goal: Define a new power operator '**' with higher precedence than multiplication '*'.
   auto mul_precedence = uc.ItemOf("*", uCalc::Properties(ItemIs::Infix)).Precedence();

   // Set the new operator's precedence to be higher than multiplication.
   uc.DefineOperator("{base} ** {exp} = Pow(base, exp)", mul_precedence + 10);

   // The new operator should be evaluated before multiplication and addition.
   // The expression is equivalent to: 2 + (3 * (2 ** 3)) -> 2 + (3 * 8) -> 2 + 24 -> 26
   cout << uc.Eval("2 + 3 * 2 ** 3") << endl;
}