Disclosed are a novel pyrrolopyrimidine ring compound as a TLR7 agonist or a pharmaceutically acceptable salt thereof, used for preventing or treating allergic rhinitis and asthma. In particular, disclosed is a compound represented by formula (I) or a pharmaceutically acceptable salt thereof