Wrote tryParse and tryParseError functions that generalize the match statement common to all the parsers so far