add prepare method in parser to build the grammar