transform named patterns into productions