using uCalcSoftware;

var uc = new uCalc();
// This example simulates a full REPL session by iterating through a series of inputs.
Console.WriteLine("uCalc Interactive Shell (simulated session)");
Console.WriteLine("Type 'exit' or 'quit' to end.");
Console.WriteLine("");

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

var index = 0;

do {
   Console.Write("> ");

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

   Console.WriteLine(input);

   // 1. Check for an exit command
   if (input == "exit" || input == "quit") {
      Console.WriteLine("Exiting.");
      return ;
   }

   // 2. Evaluate the input and 3. Print the result
   Console.WriteLine(uc.EvalStr(input));
   Console.WriteLine("");

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