Examples of VT


Examples of Dependencies.PR1.Symbols.VT

        return valor;
    }

    double E_PRIMA(double valor) {
        if (esSuma()) {
            Match(new VT("TK_MAS"));
            double valor2 = T();
            valor += valor2;
            if (esSumaResta()) {
                valor = E_PRIMA(valor);
            }
            return valor;
        }
        if (esResta()) {
            Match(new VT("TK_MENOS"));
            double valor2 = T();
            valor -= valor2;
            if (esSumaResta()) {
                valor = E_PRIMA(valor);
            }
View Full Code Here

Examples of Dependencies.PR1.Symbols.VT

        return valor;
    }

    double T_PRIMA(double valor) {
        if (esMultiplicacion()) {
            Match(new VT("TK_PROD"));
            double valor2 = F();
            valor *= valor2;
            if (esMultiplicacionDivision()) {
                valor = T_PRIMA(valor);
            }
            return valor;
        }
        if (esDivision()) {
            Match(new VT("TK_DIV"));
            double valor2 = F();
            if (valor2 == 0) {
                throw new InterpreterException("División entre 0.");
            }
            valor /= valor2;
View Full Code Here

Examples of Dependencies.PR1.Symbols.VT

        throw new ArithmeticException("Esperaba '*' o '/'.");
    }

    double F() {
        if (esParentesisAbierto()) {
            Match(new VT("TK_PAR_ABR"));
            double valor = E();
            Match(new VT("TK_PAR_CER"));
            return valor;
        }
        else if (esID()) {
            double valor = devolverTabla((String) tokenActual.getContenido());
            Match(new VT("TK_ID"));
            return valor;
        }
        else if (esNumero()) {
            double valor = 0;
            try {
                if (tokenActual.getContenido() instanceof Integer) {
                    valor = (double) (int) tokenActual.getContenido();
                }
                else //Suponemos que es double entonces
                    valor = (double) tokenActual.getContenido();
                }
            }
            catch (Exception e) {
                throw new InterpreterException("No es número entero o double");
            }
            Match(new VT("TK_CTE_NUM"));
            return valor;
        }
        else if (esNumeroD()) {
            double valor = Double.parseDouble((String) tokenActual.getContenido());
            Match(new VT("TK_NOTCNTF"));
            return valor;
        }
        else if (esMasMenos()) {
            int simbolo = MAS_MENOS(1);
            double valor = F();
View Full Code Here

Examples of Dependencies.PR1.Symbols.VT

        throw new SyntaxException("Esperaba paréntesis abierto, identificador o número.");
    }

    int MAS_MENOS(int n) {
        if (esMas()) {
            Match(new VT("TK_MAS"));
            return +n;
        }
        else if (esMenos()) {
            Match(new VT("TK_MENOS"));
            return -n;
        }
        throw new ArithmeticException("Espera '+' o '-'.");
    }
View Full Code Here

Examples of Dependencies.PR1.Symbols.VT

                VN transf = (VN) cons;
                VN copia = transf.clone();
                toReturn.add(copia);
            }
            else {
                VT transf = (VT) cons;
                VT copia = transf.clone();
                toReturn.add(copia);
            }
        }
        return toReturn;
    }
View Full Code Here

Examples of Dependencies.PR1.Symbols.VT

        //Consecuente = lambda
    }

    void PASO() {
        if (esCasa()) {
            Match(new VT("TK_CASA"));
            return;
        }
        if (esGiro()) {
            Match(new VT("TK_GIRO"));
            E();
            return;
        }
        if (esAvanza()) {
            Match(new VT("TK_AVANZA"));
            E();
            return;
        }
        if (esPinta()) {
            Match(new VT("TK_PINTA"));
            E();
            return;
        }
        if (esID()) {
            Match(new VT("TK_ID"));
            Match(new VT("TK_ASIGN"));
            E();
            return;
        }
        if (esColor()) {
            Match(new VT("TK_COLOR"));
            Match(new VT("TK_ASIGN"));
            COLOR();
            return;
        }
        if (esCondicional()) {
            Match(new VT("TK_SI"));
            CONDICIONAL();
            Match(new VT("TK_ENTONCES"));
            PASO();
            return;
        }
        if (esSalto()) {
            Match(new VT("TK_IR_A"));
            E();
            return;
        }
        throw new SyntaxException("Esperaba pinta, casa, avanza, giro, identificador, color, condicional (SI) o salto (ir_a).");
    }
View Full Code Here

Examples of Dependencies.PR1.Symbols.VT

        }
    }
   
    void COND_PAR () {
        if (esParentesisAbierto()) {
            Match(new VT("TK_PAR_ABR"));
            CONDICIONAL();
            Match(new VT("TK_PAR_CER"));
            if (esAndOr()){
                AndOr();
            }
        }
    }
View Full Code Here

Examples of Dependencies.PR1.Symbols.VT

        }
    }
   
    void NOT () {
        if (esNot()) {
            Match (new VT("TK_NOT"));
            NOT();
        }
    }
View Full Code Here

Examples of Dependencies.PR1.Symbols.VT

        }
    }
   
    void AndOr() {
        if (esAnd()) {
            Match(new VT("TK_AND"));
            CONDICIONAL();
            return;
        }
        else if (esOr()) {
            Match(new VT("TK_OR"));
            CONDICIONAL();
            return;
        }
        throw new OperatorException("Esperaba AND o OR");
    }
View Full Code Here

Examples of Dependencies.PR1.Symbols.VT

   
    void COMP () {
        E();
        if (esComparador()) {
            if (esMayor()) {
                Match(new VT("TK_MAYOR"));
            }
            else if (esMenor()) {
                Match(new VT("TK_MENOR"));
            }
            else if (esDistinto()) {
                Match(new VT("TK_DISTINTO"));
            }
            else if (esComparacion()) {
                Match(new VT("TK_IGUALDAD"));
            }
            else if (esMayorIgual()) {
                Match(new VT("TK_MAYOR_IGUAL"));
            }
            else if (esMenorIgual()) {
                Match(new VT("TK_MENOR_IGUAL"));
            }
            E();
            return;
        }
        throw new OperatorException("Esperaba comparador");
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.