(1) A person commits the offence of burglary if—
(a) he or she enters any building or part of a building as a trespasser with the intent to commit any offence under subsection (2); or
(b) having entered any building or part of a building as a trespasser he or she steals or attempts to steal anything in the building or part of it or inflicts or attempts to inflict on the person therein any grievous bodily harm.
(2) The offences referred to in subsection (1)(a) are offences of—
(a) stealing anything in the building or part of the building in question;
(b) inflicting on the person in the building any grievous bodily harm;
(c) raping a woman in the building; and
(d) doing unlawful damage to the building or anything in the building.
(3) References in subsections (1) and (2) to a building shall apply also to an uninhabited vehicle or vessel, and shall apply to any such vehicle or vessel at times when the person having a habitation in it is not there as well as at times when he or she is.
(4) A person who commits the offence of burglary is liable on conviction on indictment to imprisonment for 20 years.