The invention relates to pyrrole pyrimidine compounds as TLR7 agonists, in particular to compounds of formula (I) or pharmaceutically acceptable salts thereof, preparation methods thereof, pharmaceutical compositions containing such compounds, and use for preparing antiviral drugs.本發明涉及作爲TLR7激動劑的吡咯并嘧啶化合物,具體涉及式(I)化合物或其藥學上可接受的鹽、其製備方法、含有該類化合物的藥物組合物、及其用於製備抗病毒藥物的用途。