Example #1
0
        private void SetConnotialBetweenTerminals(Connotial connotial, string leftTerminal, string rightTerminal)
        {
            int row    = this.terminals[leftTerminal];
            int column = this.terminals[rightTerminal];

            this.table[row][column] = connotial;
        }
Example #2
0
        public string ConnotialToString(Connotial con)
        {
            char connotial = ' ';

            switch (con)
            {
            case Connotial.NoConnotial:     connotial = ' '; break;

            case Connotial.LessConnotial:   connotial = '<'; break;

            case Connotial.GreaterConnotial: connotial = '>'; break;

            case Connotial.EqualConnotial:  connotial = '='; break;
            }
            string connotialString = "[";

            connotialString += connotial + "] ";
            return(connotialString);
        }
Example #3
0
        void RepairTable()
        {
            List <string> recievers = new List <string>()
            {
                "ID", "CONST", "<expr.response>", "<multiplier>", "<term>",
                "<expr.response2>", "<multiplier2>", "<term2>", ")"
            };
            List <string> problems = new List <string>()
            {
                "+", "-", "*", "/", "^", "to", ">", ">=", "<", "<=", "!=", "equ", "and", "or", "]"
            };

            Connotial conBetweenTermMult  = ConnotialBetweenTerminals("<term>", "*");
            Connotial conBetweenTerm2Mult = ConnotialBetweenTerminals("<term2>", "*");

            foreach (string reciever in recievers)
            {
                foreach (string problem in problems)
                {
                    SetConnotialBetweenTerminals(Connotial.GreaterConnotial, reciever, problem);
                }
            }

            SetConnotialBetweenTerminals(Connotial.EqualConnotial, "<list of var>", ")");
            SetConnotialBetweenTerminals(Connotial.EqualConnotial, "<multiplier>", "^");
            SetConnotialBetweenTerminals(conBetweenTermMult, "<term>", "*");
            SetConnotialBetweenTerminals(conBetweenTermMult, "<term>", "/");
            //SetConnotialBetweenTerminals(Connotial.LessConnotial,reciever,problem);
            SetConnotialBetweenTerminals(Connotial.GreaterConnotial, "<term>", "^");
            SetConnotialBetweenTerminals(conBetweenTerm2Mult, "<term2>", "*");
            SetConnotialBetweenTerminals(conBetweenTerm2Mult, "<term2>", "/");
            SetConnotialBetweenTerminals(Connotial.EqualConnotial, "<term2>", "^");

            problems.Remove("+");
            problems.Remove("-");
            problems.Remove("/");
            problems.Remove("^");
            problems.Remove("*");
            problems.Remove("to");
            recievers.Clear();
            recievers.Add("<expression>");
            recievers.Add("<expression2>");
            foreach (string reciever in recievers)
            {
                foreach (string problem in problems)
                {
                    SetConnotialBetweenTerminals(Connotial.GreaterConnotial, reciever, problem);
                }
            }
            problems.Remove(">");
            problems.Remove("<");
            problems.Remove(">=");
            problems.Remove("<=");
            problems.Remove("!=");
            problems.Remove("equ");
            problems.Remove("]");
            recievers.Clear();
            recievers.Add("<relation>");
            recievers.Add("<log.exp.lev2>");
            recievers.Add("]");
            foreach (string reciever in recievers)
            {
                foreach (string problem in problems)
                {
                    SetConnotialBetweenTerminals(Connotial.GreaterConnotial, reciever, problem);
                }
            }
            SetConnotialBetweenTerminals(Connotial.GreaterConnotial, "<log.exp.lev1>", "or");


            for (int j = 0; j < terms.Count - 1; j++)
            {
                SetConnotialBetweenTerminals(Connotial.LessConnotial, "#", terms[j]);
            }
            SetConnotialBetweenTerminals(Connotial.NoConnotial, "#", "#");
        }