diff options
| author | Marshall Lochbaum <mwlochbaum@gmail.com> | 2020-09-14 16:56:01 -0400 |
|---|---|---|
| committer | Marshall Lochbaum <mwlochbaum@gmail.com> | 2020-09-14 16:56:01 -0400 |
| commit | 1450c56754c1b2a1b42fc78547f384b83aa8dc13 (patch) | |
| tree | fe26d167a65e34525dc2aa598d2bd4df1945b136 /spec | |
| parent | c6cc1584c1a9aa5c30c39f272e1300a7be76323d (diff) | |
Don't allow ∞ with an exponent in numeric literals
Diffstat (limited to 'spec')
| -rw-r--r-- | spec/literal.md | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/spec/literal.md b/spec/literal.md index 58e1b816..edf91b83 100644 --- a/spec/literal.md +++ b/spec/literal.md @@ -9,9 +9,9 @@ Two types of literal deal with text. As the source code is considered to be a se The format of a *numeric literal* is more complicated. From the [tokenization rules](token.md), a numeric literal consists of a numeric character (one of `¯∞π.0123456789`) followed by any number of numeric or alphabetic characters. Some numeric literals are *valid* and indicate a number, while others are invalid and cause an error. The grammar for valid numbers is given below in a [BNF](https://en.wikipedia.org/wiki/Backus%E2%80%93Naur_form) variant. Only four alphabetic characters are allowed: "i", which separates the real and imaginary components of a complex number, "e", which functions as in scientific notation, and the uppercase versions of these letters. number = component ( ( "i" | "I" ) component )? - component = mantissa ( ( "e" | "E" ) exponent )? + component = "¯"? ( "∞" | mantissa ( ( "e" | "E" ) exponent )? ) exponent = "¯"? digit+ - mantissa = "¯"? ( "∞" | "π" | digit+ ( "." digit+ )? ) + mantissa = "π" | digit+ ( "." digit+ )? digit = "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9" The digits or arabic numerals correspond to the numbers from 0 to 9 in the conventional way (also, each corresponds to its code point value minus 48). A sequence of digits gives a natural number by evaluating it in base 10: the number is 0 for an empty sequence, and otherwise the last digit's numerical value plus ten times the number obtained from the remaining digits. The symbol `∞` indicates infinity and `π` indicates the ratio [pi](https://en.wikipedia.org/wiki/Pi_(mathematics)) of a circle's circumference to its diameter (or, for modern mathematicians, the smallest positive real number at which the function `{⋆0i1×𝕩}` attains a real part of 0). The [high minus](https://aplwiki.com/wiki/High_minus) symbol `¯` indicates that the number containing it is to be negated. |
