Add facility for building an sptree in SML.