Пример #1
0
 public Expresiones Andexp_prime(Expresiones E1)
 {
     if (currentToken.Tipo == Lexico.TipoToken.TK_AND)
     {
         currentToken = lex.NextToken();
         Expresiones E= Addexp();
         And eAnd= new And(E1, Andexp_prime(E));
         return eAnd;
     }
     return E1;
 }
Пример #2
0
 public Expresiones ANDExprP(Expresiones E)
 {
     if (currentToken.Tipo == TipoToken.TK_AND)
     {
         currentToken = lex.NextToken();
         Expresiones E1 = ANDExpr();
         And eAnd = new And(E, ANDExprP(E1));
         return eAnd;
     }
     else
     {
         return E;
     }
 }
Пример #3
0
 public Expresiones Addexp_prime(Expresiones E)
 {
     if (currentToken.Tipo == Lexico.TipoToken.TK_SUMA)
     {
         currentToken = lex.NextToken();
         Suma sum = new Suma(E, Addexp_prime(Addexp()));
         return sum;
     }
     else if (currentToken.Tipo == Lexico.TipoToken.TK_RESTA)
     {
         currentToken = lex.NextToken();
         Resta rest = new Resta(E, Addexp_prime(Addexp()));
         return rest;
     }
     return E;
 }
Пример #4
0
        public Expresiones AddExprP(Expresiones E)
        {
            if (currentToken.Tipo == TipoToken.TK_SUMA)
            {
                currentToken = lex.NextToken();
                Suma Sum = new Suma(E, AddExprP(AddExpr()));

                return Sum;
            }
            else if (currentToken.Tipo == TipoToken.TK_RESTA)
            {
                currentToken = lex.NextToken();
                Resta Res = new Resta(E, AddExprP(AddExpr()));

                return Res;
            }
            else
            {
                return E;
            }
        }
Пример #5
0
 public ListaExpre ExprList(Expresiones E)
 {
     try
     {
         if (currentToken.Tipo == TipoToken.TK_COMA)
         {
             currentToken = lex.NextToken();
             ((ListaExpre) E).Ex.Add(Expr());
             return ExprList(E);
         }
         else
         {
             return ((ListaExpre) E);
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Пример #6
0
 public Division(Expresiones izq, Expresiones der)
     : base(izq, der)
 {
 }
Пример #7
0
 public Resta(Expresiones izq, Expresiones der)
     : base(izq, der)
 {
 }
Пример #8
0
 public Or(Expresiones izq, Expresiones der)
 {
     Izq = izq;
     Der = der;
 }
Пример #9
0
 public Multiplicacion(Expresiones izq, Expresiones der)
     : base(izq, der)
 {
 }
Пример #10
0
 public MenorQue(Expresiones izq, Expresiones der)
 {
     Izq = izq;
     Der = der;
 }
Пример #11
0
 Expresiones addexprime(Expresiones par)
 {
     try
     {
         switch (currentToken.Tipo)
         {
             case TipoToken.TK_SUMA:
                 currentToken = lex.NextToken();
                 return new Suma(par, addexprime(multexp()));
             case TipoToken.TK_RESTA:
                 currentToken = lex.NextToken();
                 return new Resta(par, addexprime(multexp()));
             default:
                 return par;
         }
     }
     catch (Exception ex) { throw ex; }
 }
Пример #12
0
 public Expresiones Relexp_prime(Expresiones E)
 {
     if (currentToken.Tipo == Lexico.TipoToken.TK_IGUALDAD)
     {
         Equal equal = new Equal(E, Addexp());
         currentToken = lex.NextToken();
         return equal;
     }
     else if (currentToken.Tipo == Lexico.TipoToken.TK_DISTINTO)
     {
         Distinto dist = new Distinto(E, Addexp());
         currentToken = lex.NextToken();
         return dist;
     }
     else if (currentToken.Tipo == Lexico.TipoToken.TK_MAYORQUE)
     {
         MayorQue mayorQ = new MayorQue(E, Addexp());
         currentToken = lex.NextToken();
         return mayorQ; ;
     }
     else if (currentToken.Tipo == Lexico.TipoToken.TK_MAYORIGUAL)
     {
         MayorIgual mayorI = new MayorIgual(E, Addexp());
         currentToken = lex.NextToken();
         return mayorI;
     }
     else if (currentToken.Tipo == Lexico.TipoToken.TK_MENORQUE)
     {
         MenorQue menorQ = new MenorQue(E, Addexp());
         currentToken = lex.NextToken();
         return menorQ;
     }
     else if (currentToken.Tipo == Lexico.TipoToken.TK_MENORIGUAL)
     {
         MenorIgual menorI = new MenorIgual(E, Addexp());
         currentToken = lex.NextToken();
         return menorI;
     }
     return E;
 }
Пример #13
0
 public Expresiones Multexp_prime(Expresiones E)
 {
     if (currentToken.Tipo == Lexico.TipoToken.TK_MULT)
     {
         currentToken = lex.NextToken();
         Multiplicacion mult = new Multiplicacion(E,Multexp_prime(Multexp()));
         return mult;
     }
     else if (currentToken.Tipo == Lexico.TipoToken.TK_DIV)
     {
         currentToken = lex.NextToken();
         Division div = new Division(E, Multexp_prime(Multexp()));
         return div;
     }
     else if (currentToken.Tipo == Lexico.TipoToken.TK_MOD)
     {
         currentToken = lex.NextToken();
         Mod mod = new Mod(E, Multexp_prime(Multexp()));
         return mod;
     }
     return E;
 }
Пример #14
0
 public Expresiones Expression_prime(Expresiones E)
 {
     if (currentToken.Tipo == Lexico.TipoToken.TK_OR)
     {
         currentToken = lex.NextToken();
         Expresiones E1 = Expression();
         Or eor = new Or(E, Expression_prime(E1));
         return eor;
     }
     return E;
 }
Пример #15
0
        public Expresiones ExprP(Expresiones E)
        {
            if (currentToken.Tipo == TipoToken.TK_OR)
            {
                currentToken = lex.NextToken();
                try
                {
                    Expresiones E1 = Expr();
                    Or eOr = new Or(E, ExprP(E1));
                    return eOr;
                }
                catch (Exception ex)
                {
                    throw ex;
                }

            }
            else
            {
                return E;
            }
        }
Пример #16
0
        public Expresiones MultExprP(Expresiones E)
        {
            if (currentToken.Tipo == TipoToken.TK_MULT)
            {
                currentToken = lex.NextToken();
                Multiplicacion Mult = new Multiplicacion(E, MultExprP(MultExpr()));
                return Mult;

            }
            else if (currentToken.Tipo == TipoToken.TK_DIVISION)
            {
                currentToken = lex.NextToken();
                Division Div = new Division(E, MultExprP(MultExpr()));
                return Div;
            }
            else if (currentToken.Tipo == TipoToken.TK_MOD)
            {
                currentToken = lex.NextToken();
                Mod Md = new Mod(E, MultExprP(MultExpr()));
                return Md;
            }
            else
            {
                return E;
            }
        }
Пример #17
0
        public Expresiones RelExprP(Expresiones E)
        {
            if (currentToken.Tipo == TipoToken.TK_IGUALDAD)
            {
                currentToken = lex.NextToken();
                Equal eEqual = new Equal(E, AddExpr());
                return eEqual;
            }
            else if (currentToken.Tipo == TipoToken.TK_DISTINTO)
            {
                currentToken = lex.NextToken();
                Distinto eDist = new Distinto(E, AddExpr());

                return eDist;
            }
            else if (currentToken.Tipo == TipoToken.TK_MAYORQUE)
            {
                currentToken = lex.NextToken();
                MayorQue eMayQ = new MayorQue(E, AddExpr());

                return eMayQ;
            }
            else if (currentToken.Tipo == TipoToken.TK_MENORQUE)
            {
                currentToken = lex.NextToken();
                MenorQue eMenQ = new MenorQue(E, AddExpr());

                return eMenQ;
            }
            else if (currentToken.Tipo == TipoToken.TK_MENORIGUAL)
            {
                currentToken = lex.NextToken();
                MenorIgual eMenI = new MenorIgual(E, AddExpr());

                return eMenI;
            }
            else if (currentToken.Tipo == TipoToken.TK_MAYORIGUAL)
            {
                currentToken = lex.NextToken();
                MayorIgual eMayI = new MayorIgual(E, AddExpr());

                return eMayI;
            }
            else
            {
                return E;
            }
        }
Пример #18
0
 Expresiones andexPrime(Expresiones par)
 {
     if (currentToken.Tipo == TipoToken.TK_AND)
     {
         currentToken = lex.NextToken();
         try
         {
             return andexPrime(new And(par, relexp()));
         }
         catch (Exception ex) { throw ex; }
     }
     else return par;
 }
Пример #19
0
 public MenorIgual(Expresiones izq, Expresiones der)
 {
     Izq = izq;
     Der = der;
 }
Пример #20
0
 Expresiones exPrime(Expresiones par)
 {
     if (currentToken.Tipo == TipoToken.TK_OR)
     {
         currentToken = lex.NextToken();
         try
         {
             return exPrime(new Or(par, andExp()));
         }
         catch (Exception ex) { throw ex; }
     }
     else return par;
 }
Пример #21
0
 public Mod(Expresiones izq, Expresiones der)
     : base(izq, der)
 {
 }
Пример #22
0
 Expresiones multexprime(Expresiones par)
 {
     try{
         switch (currentToken.Tipo)
         {
             case TipoToken.TK_MULT:
                 currentToken = lex.NextToken();
                 return new Multiplicacion(par, multexprime(parexp()));
             case TipoToken.TK_DIVISION:
                 currentToken = lex.NextToken();
                 return new Division(par, multexprime(parexp()));
             case TipoToken.TK_MOD:
                 currentToken = lex.NextToken();
                 return new Mod(par, multexprime(parexp()));
             case TipoToken.TK_DIV:
                 currentToken = lex.NextToken();
                 return new Division(par, multexprime(parexp()));
             default:
                 return par;
         }
     }
     catch (Exception ex) { throw ex; }
 }
Пример #23
0
 public OperacionBinaria(Expresiones izq, Expresiones der)
 {
     Izq = izq;
     Der = der;
 }
Пример #24
0
 Expresiones relexprime(Expresiones par)
 {
     try
     {
         switch (currentToken.Tipo)
         {
             case TipoToken.TK_IGUALDAD:
                 currentToken = lex.NextToken();
                 return new Equal(par, addexp());
             case TipoToken.TK_DISTINTO:
                 currentToken = lex.NextToken();
                 return new Distinto(par, addexp());
             case TipoToken.TK_MAYORIGUAL:
                 currentToken = lex.NextToken();
                 return new MayorIgual(par, addexp());
             case TipoToken.TK_MAYORQUE:
                 currentToken = lex.NextToken();
                 return new MayorQue(par, addexp());
             case TipoToken.TK_MENORIGUAL:
                 currentToken = lex.NextToken();
                 return new MenorIgual(par, addexp());
             case TipoToken.TK_MENORQUE:
                 currentToken = lex.NextToken();
                 return new MenorQue(par, addexp());
             default:
                 return par;
         }
     }
     catch (Exception ex) { throw ex; }
 }
Пример #25
0
 public Distinto(Expresiones izq, Expresiones der)
 {
     Izq = izq;
     Der = der;
 }
Пример #26
0
 public ListaExpre ExprListP(Expresiones E)
 {
     if (currentToken.Tipo == TipoToken.TK_COMA)
     {
         currentToken = lex.NextToken();
         Expresiones E1 = Expr();
         return ExprListP(E1);
     }
     else
     {
         ListaExpre LE = new ListaExpre();
         LE.Ex.Add(E);
         return LE;
     }
 }
Пример #27
0
 public Suma(Expresiones izq, Expresiones der)
     : base(izq, der)
 {
 }
Пример #28
0
        public Expresiones ExprP(Expresiones E)
        {
            if (currentToken.Tipo == TipoToken.TK_OR)
            {

                currentToken = lex.NextToken();
                Expresiones E1 = Expr();
                Or eOr = new Or(E, ExprP(E1));
                return eOr;
            }
            else
            {
                return E;
            }
        }
Пример #29
0
 public Equal(Expresiones izq, Expresiones der)
 {
     Izq = izq;
     Der = der;
 }
Пример #30
0
        public Expresiones ANDExprP(Expresiones E)
        {
            if (currentToken.Tipo == TipoToken.TK_AND)
            {
                currentToken = lex.NextToken();
                try
                {
                    Expresiones E1 = ANDExpr();
                    And eAnd = new And(E, ANDExprP(E1));
                    return eAnd;
                }
                catch (Exception ex)
                {

                    throw ex;
                }
            }
            else
            {
                return E;
            }
        }