a Noncontracting Grammar written in Python 2.7