create compile function