public SemanticRec gen_assign_cast(SemanticRec left, SemanticRec right)
    {
        Type leftType = getTypeFromSR(left);
        Type rightType = getTypeFromSR(right);

        SemanticRec returnRec = null;
        if (leftType == rightType)
        {
            //no cast needed
            returnRec = right; //the expressions RecordType is unchanged
        }
        else if ((leftType == Type.INTEGER) && rightType == Type.FLOAT)
        {
            //cast to integer
            castStackToI();
            returnRec = new SemanticRec(RecordType.LITERAL, Type.INTEGER.toString()); //now an integer on the stack
        }
        else if (leftType == Type.FLOAT && (rightType == Type.INTEGER))
        {
            //cast to float
            castStackToF();
            returnRec = new SemanticRec(RecordType.LITERAL, Type.FLOAT.toString()); //now a float on the stack
        }
        else
        {
            //invalid cast
            Parser.semanticError("Invalid cast from " + rightType + " to " + leftType);
        }

        return returnRec;
    }