parser using Python generator