Heterocyclic pyrimidine compounds that modulate mutant selective epidermal growth factor receptor (EGFR) and ALK kinase activity are disclosed. More specifically the invention provides pyrimidines which inhibit regulate and/or modulate kinase receptor particularly in selectively modulation of various EGFR mutant activity and ALK kinase activity have been disclosed. Pharmaceutical compositions comprising the pyrimidine derivative and methods of treatment for diseases associated with protein kinase enzymatic activity particularly EGFR or ALK kinase activity including non small cell lung cancer comprising administration of the pyrimidine derivative are disclosed.