The task of the expander for the Macro COSY programs is to expand the Macro COSY program to a basic program which is equivalent to the Basic COSY program. In this project, what I am mainly concerned with is the expansion of Macro COSY programs. The old expander expands the Macro COSY program from a string into basic program which is a string as well. The new expander we designed is to expand the Macro COSY program from a tree into a tree.