public String translate(){     
        fillData();
        
        String error = validate();
        if (error != null){
            tulip.Tulip.mainFrame.writeConsole(error);
            return null;
        }
   
        String result = "program "+ name.substring(0, (name.indexOf(".") > 0)?name.indexOf("."):name.length() )+" \n begin\n";
        for (AbstractUnit unit : units) {
            if(unit instanceof IInstructionUnit){
                result += ((IInstructionUnit)unit).getInstruction(unit.unitNumber) + "\n";
            }
        }
        result += "end\n";
        
        return result;
    }