Numbers
Int
Int = hexadecimal_number
| octal_number
| binary_number
| decimal_number
hexadecimal_number = "0", ("x" | "X"), hexadecimal_digit+
octal_number = "0", ("o" | "O"), octal_digit+
binary_number = "0", ("b" | "B"), binary_digit+
decimal_number = "1".."9", decimal_digit*
12345
01234 // This is an error, a decimal number cant have
// leading zeroes
0o755 // This is octal
0b0110
0xff25
0xFfaA
thp
TODO
: Allow underscores _
between any number: 1_000_000
.
Float
Float = decimal_digit+, ".", decimal_digit+, scientific_notation?
| decimal_digit+, scientific_notation
scientific_notation = "e", ("+" | "-"), decimal_digit+
123.456
123.456e+4
123.456e-2
123e+10
123e-3
thp
All floating point numbers must start with at least 1 digit.
.5
is not a valid floating point number.
TODO
: Allow scientific notation to omit the +
/-
: 10e4
.