Tidy up build_parse_table function