private boolean isBinaryBoolean(BinaryExpr exp) { Expr left = exp.getLeft(); Expr right = exp.getRight(); if (left.accept(this) && right.accept(this)) return (left.typeOf(environment).equals(new BoolType()) && right.typeOf(environment).equals(new BoolType())); else return false; }
@Override public Boolean visit(Not exp) { Expr unExpr = exp.getExpr(); if (!(unExpr.typeOf(environment) == new BoolType())) { errorMsgs.add(String.format("Not expression is not a boolean: %s", exp)); return false; } return unExpr.accept(this); }