implement parse_rules