Use a type def for the return type of parses and deduplicate parser mod codegen in lib