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

using namespace std;
using namespace uCalcSoftware;

int main() {
   uCalc uc;
   // This example simulates a full REPL session by iterating through a series of inputs.
   cout << "uCalc Interactive Shell (simulated session)" << endl;
   cout << "Type 'exit' or 'quit' to end." << endl;
   cout << "" << endl;

   vector<string> inputs = {
      "10 * (5 + 3)",
      "UCase('hello world')",
      "1 / 0",
      "1 +",
      "exit"
   };

   auto index = 0;

   do {
      cout << "> ";

      // Simulate reading from the console by assigning inputs sequentially.
      // In a real application, this would read the input interactively from the console.
      auto input = inputs[index];

      cout << input << endl;

      // 1. Check for an exit command
      if (input == "exit" || input == "quit") {
         cout << "Exiting." << endl;
         return 0;
      }

      // 2. Evaluate the input and 3. Print the result
      cout << uc.EvalStr(input) << endl;
      cout << "" << endl;

      index = index + 1;
   } while (true);
}