A real parser handles a leading minus, collapses a negative zero, and refuses garbage. Today you wrap the magnitude parser into the public Parse and pin its edges.
Parse an optional leading minus and digits into a BigInt, rejecting invalid input and canonicalizing "-0".
parseMag trusts its input; Parse does not. It peels an optional leading -,
then requires that what remains is a non-empty run of decimal digits - an empty
string, a lone -, or anything with a non-digit character is an error, not a
zero. Leading zeros are fine ("007" is 7), because grouping and normalization
handle them for free.
The one rule to hold onto is the canonical zero from lesson 3: if the parsed
magnitude is empty, the sign must be 0 regardless of a leading minus, so "-0"
parses to the same value as "0". Wire that check in here and negative zero can
never enter the system through the front door.
func Parse(s string) (BigInt, error) {neg := falseif len(s) > 0 && s[0] == '-' { neg = true; s = s[1:] }// reject empty body or any non-digit rune herem := parseMag(s)sign := 1if len(m) == 0 { sign = 0 } else if neg { sign = -1 }return BigInt{sign, m}, nil}