Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public Atr_Expr AS_Exp_Bin_Rel (Atr_Expr e1,Atr_Expr e2,AST op)
- {
- Atr_Expr res=new Atr_Expr();
- AST tipo;
- if(e1== null || e2==null || op==null)
- { System.out.println("ERROR AS_EXPRESION_BINARIA_RELACIONAL: Parámetros nulos");
- return res;
- }
- if((e1.getRval()==false) || (e2.getRval()==false))
- {
- System.out.println("ERROR AS_EXPRESION_BINARIA_RELACIONAL: e1 o e2 no tienen Rval ");
- tipo = #(#[ERROR,"error"]);
- res.setTipo(tipo);
- return res;
- }
- if(clases_iguales(e1.getTipo(),e2.getTipo())== false)
- {
- System.out.println("ERROR AS_EXPRESION_BINARIA_RELACIONAL: e1 y e2 no son de la misma clase");
- tipo = #(#[ERROR,"error"]);
- res.setTipo(tipo);
- return res;
- }
- if ((e1.getTipo().getType()==CLASE || e1.getTipo().getType()== LOGICO || e1.getTipo().getType()== FORMACION)
- &&(op.getType() != IGUAL && op.getType() != DISTINTO))
- {
- System.out.println("ERROR AS_EXPRESION_BINARIA_RELACIONAL: e1 y e2 si no son numeros, solo pueden usar igual o distinto");
- tipo = #(#[ERROR,"error"]);
- res.setTipo(tipo);
- return res;
- }
- tipo = #(#[LOGICO,"logico"]);
- res.setTipo(tipo);
- res.setLval(false);
- res.setRval(true);
- return res;
- }
Add Comment
Please, Sign In to add comment