Decimal numbers may have an optional leading plus, minus, or not sign followed by a decimal digit and additional digits or underscores. They cannot have leading or trailing underscores.
DecimalInteger := ['+' | '-' | '~'] DecimalDigit ('_'* DecimalDigit)* DecimalDigit := '0' to '9'
Hexadecimal, octal, or binary numbers have an optional sign, a prefix indication the radix, and is followed by digits corresponding to the radix and underscores. They may not have trailing underscores.
RadixInteger := ['+' | '-' | '~'] {HexInteger | OctalInteger | BinaryInteger} HexInteger := '#' HexDigit ('_'* HexDigit)* HexDigit := Digit | 'A' to 'F' | 'a' to 'f' OctalInteger := '8#' OctalDigit ('_'* OctalDigit)* OctalDigit := '0' to '7' BinaryInteger := '2#' BinaryDigit ( '_'* BinaryDigit) BinaryDigit := '0' | '1'