private static Term eval(Term term, HashMap<String, Term> env) throws ParseException {
        if (Util.getOperators().contains(term.getPred())) {
            Integer a = Integer.parseInt(eval(term.getArgs().get(0), env).getPred());
            Integer b = Integer.parseInt(eval(term.getArgs().get(1), env).getPred());
            if (term.getPred().equals("+")) {
                return new Term(new Integer(a + b).toString(), null);
            }
            if (term.getPred().equals("-")) {
                return new Term(new Integer(a - b).toString(), null);
            }
            if (term.getPred().equals("*")) {
                return new Term(new Integer(a * b).toString(), null);
            }
        }
        // TODO: How to set types for lt, eq, original uses booleans
        if (isConstant(term)) {
            return term;
        }
        if (isVariable(term)) {
            Term ans = env.get(term.getPred());
            if (ans == null) {
                return null;
            }
            return eval(ans, env);
        }
        ArrayList<Term> args = new ArrayList<Term>();
        for (Term arg : term.getArgs()) {
            Term a = eval(arg, env);
            if (a == null) {
                return null;
            }
            args.add(a);
        }
        return new Term(term.getPred(), args);
    }