(1)A person is guilty of burglary if—
(a)he enters any building or part of a building as a trespasser and with intent to commit any such offence as is mentioned in subsection (2) below; or
(b)having entered any building or part of a building as a trespasser he steals or attempts to steal anything in the building or that part of it or inflicts or attempts to inflict on any person therein any grievous bodily harm.
(2)The offences referred to in subsection (1)(a) above are offences of stealing anything in the building or part of a building in question, of inflicting on any person therein any grievous bodily harm F1... therein, and of doing unlawful damage to the building or anything therein.
[F2(3)A person guilty of burglary shall on conviction on indictment be liable to imprisonment for a term not exceeding—
(a)where the offence was committed in respect of a building or part of a building which is a dwelling, fourteen years;
(b)in any other case, ten years.
(4)References in subsections (1) and (2) above to a building, and the reference in subsection (3) above to a building which is a dwelling, shall apply also to an inhabited 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 is.]