Using the BNF language, a number can be defined as follows:
$ Number = Integer | Double
$ Integer = [sign] digit {digit}
$ Double = [sign] digit {digit} "." {digit} [Scale]
$ digit = “0” | “1” | “2” | “3” | “4” | “5” | “6” | “7” | “8” | “9”
$ sign = “+” | “-”
$ Scale = (“E” | “e”) [sign] digit {digit}
$ integer = [sign] digit {digit}
A number (number) is a signed integer or real number.
See also: