Implemented Python grammar search