extended the tokensToProgram function and added a flag to the compilation procedure