/// <summary>
        /// Call back for the button click event
        /// </summary>
        /// <param name="sender">Represents the button clicked</param>
        /// <param name="e">Eventargs</param>
        private void Button_Click(object sender, EventArgs e)
        {
            try
            {
                //Format the input text to change the operators
                Query.Text = FormatInput(Query.Text);

                //Create an instance of the evaluator class
                Evaluator evaluator = new Evaluator(Query.Text);

                //Display a heading on each tab
                PdnfLabel.Content = PcnfLabel.Content = EvalLabel.Content = TableLabel.Content = PlanLabel.Content = "Query: " + evaluator.Query;

                //Update the truth Table, tree view and the plan textbox
                TruthTable.ItemsSource = evaluator.EvaluateQuery();
                new TreeDiag(evaluator.EvalPlan, TreePlan);
                Pcnf.Text = evaluator.FindPCNF();
                Pdnf.Text = evaluator.FindPDNF();
                Plan.Text = evaluator.GetEvaluationPlan();
            }
            catch
            {
                //If, at all anything goes wrong
                //The only possible case is when the symbols are unbalanced
                //Or, there is no input in the text-box
                if (Query.Text.Length == 0) { MessageBox.Show("No Query in the Text Box", "No Query"); }
                else { MessageBox.Show("Warning: Unbalanced Symbols found in the Stack", "Error in Query"); }
            }
        }
        /// <summary>
        /// Called when we want to compare two strings
        /// </summary>
        /// <param name="sender">Compare Button</param>
        /// <param name="e">Event Args</param>
        private void Compare_Click(object sender, EventArgs e)
        {
            try
            {
                //Format the input text to change the operators
                Query.Text = FormatInput(Query.Text);
                CompareQuery.Text = FormatInput(CompareQuery.Text);

                //Create an instance of the evaluator class
                Evaluator evaluator1 = new Evaluator(Query.Text);
                Evaluator evaluator2 = new Evaluator(CompareQuery.Text);

                //Evaluate query and find the results
                evaluator1.EvaluateQuery();
                evaluator2.EvaluateQuery();

                //Get the results array
                bool[] query1Result = evaluator1.GetResultData();
                bool[] query2Result = evaluator2.GetResultData();

                //Compare each of the result fields
                bool equalFlag = false;
                if(query1Result.Length == query2Result.Length)
                {
                    equalFlag = true;
                    for (int i = 0; i < query1Result.Length; i++) { if (query1Result[i] != query2Result[i]) { equalFlag = false; break; } }
                }

                //Display a message box according to the result
                if (equalFlag == true) { MessageBox.Show("The two expressions are Equivalent", "Equivalent Expressions"); }
                else { MessageBox.Show("The two expressions are not Equivalent", "Non - Equivalent Expressions"); }

            }
            catch
            {
                //If, at all anything goes wrong
                //The only possible case is when the symbols are unbalanced
                //Or, there is no input in the text-box
                if (Query.Text.Length == 0 || CompareQuery.Text.Length == 0) { MessageBox.Show("No Query in the Text Box", "No Query"); }
                else { MessageBox.Show("Warning: Unbalanced Symbols found in the Stack", "Error in Query"); }
            }
        }