implement createCodeTree