implement rule parser