Module NumTok
Numerals in different forms: signed or unsigned, possibly with fractional part and exponent.
Numerals are represented using raw strings of (hexa)decimal literals and a separate sign flag.
Note that this representation is not unique, due to possible multiple leading or trailing zeros, and -0 = +0, for instances. The reason to keep the numeral exactly as it was parsed is that specific notations can be declared for specific numerals (e.g. Notation "0" := False
, or Notation "00" := (nil,nil)
, or Notation "2e1" := ...
). Those notations override the generic interpretation as numeral. So, one has to record the form of the numeral which exactly matches the notation.
String representation of a natural number
module UnsignedNat : sig ... end
String representation of a signed natural number
module SignedNat : sig ... end
Unsigned decimal numerals
module Unsigned : sig ... end
Signed decimal numerals
module Signed : sig ... end