예제 #1
0
 public Expresiones Addexp_prime(Expresiones E)
 {
     try
     {
         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;
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
예제 #2
0
        public Expresiones AddExprP(Expresiones E)
        {
            try
            {
                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;
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }