Context-wise construction of the Burrows-Wheeler transform in compressed space