A new system which implements a new Macro COSY environment has been created using SML. This system consists of four main processors. The first processor is a Lexical Analyzer. It inputs the COSY program which is represented as a string and changes it into a token list. The second processor is a Parser. It inputs a token list and uses it to construct a syntax tree according to the Macro COSY grammar. The syntax tree which is produced by the Parser is a context-free syntax tree. So, the third processor is a Context-Sensitive Restrictions Checker. It checks whether the syntax tree satisfies all context-sensitive Restrictions. The last processor is the Expander. It expands the Macro COSY program from its corresponding syntax tree into a new syntax tree which is in the form of a Basic COSY program. In this paper, we will mainly discuss the Macro COSY expansion. We also discuss how to use the SML module facilities to code this new system.