You need to have an EOF character in the string for BWT to work, because otherwise you will not be able to perform the inverse conversion to return the original string. Without EOF, both strings "ba" and "ab" have the same converted version ("ba"). With EOF, conversions are different.
ab ba ab | a | b b | aba | | ab | ba
i.e. ab is converted to "| ab" and ba to "b | a".
EOF is necessary for BWT because it marks the starting point of a character loop.
Re: do it without an EOF symbol, according to Wikipedia,
Since any rotation of the input string will lead to the same converted string, the BWT cannot be flipped without adding an EOF, an input marker, or, supplementing the output with information such as an index that allows you to identify the input string from the class of all its rotations.
There is a bijective version of the conversion by which the transformed string uniquely identifies the original. In this version, each line has a unique inverse of the same length.
A bijective transformation is calculated by first factoring the input into a non-increasing sequence of Lyndon's words; such factorization exists by the Chen-Fox-Lindon theorem and can be found in linear time. Then the algorithm sorts all the rotations of all these words; as in the usual Burroughs-Wheeler transform, this creates an ordered sequence of n lines. Then the converted string is obtained by selecting the final character of each of these strings in this sorted list.
source share