public int NumberParser(String str){
        // Parses valid number for different formats from Strings 
        // used for parsing numerical arguments like immediate values and 
        // address jumps and memory initializations
        int x=0;
        String temp="";
        if(str.length()>2)
        temp=str.substring(0,2);
       // System.out.println("temp parsing "+temp);
        if(isNumeric(str)){
                 try{
                    x=Integer.parseInt(str,10);
                }catch (NumberFormatException e){
                        return ErrorManager.INVALID_NUMERAL;
                }
              
        }
        else if(temp.equals("0x"))
        {
            temp=str.substring(2);
            try{
                x=Integer.parseInt(temp,16);
            }catch (NumberFormatException e){
                     //  System.out.println("Temp="+temp); 
                       return ErrorManager.INVALID_NUMERAL;
            }
            }else if(temp.equals("0b")){
                     temp=str.substring(2);
                     try{
                       x=Integer.parseInt(temp,2);
                     }catch (NumberFormatException e){
                         return ErrorManager.INVALID_NUMERAL;
                     }
             }else if(temp.equals("0d")){
                temp=str.substring(2);
                try{
                    x=Integer.parseInt(temp,10);
                }catch (NumberFormatException e){
                        return ErrorManager.INVALID_NUMERAL;
                }
                }
             
             else return ErrorManager.INVALID_NUMERAL; 
             
        return x; //return the 16 bit instruction word
    }