implement ratio parsing