parsing ribbon into PPG encoding