edited algorithm of compiling