implemented compileS, part of compileB