A characterization of the L-representation algebra \mathfrakR(S) of a foundation semigroup and its application to BSE algebras