Change grammar to support Python 3