aboutsummaryrefslogtreecommitdiff
path: root/doc/language.tex
diff options
context:
space:
mode:
authorEugen Wissner <belka@caraus.de>2026-07-14 18:08:44 +0200
committerEugen Wissner <belka@caraus.de>2026-07-14 18:08:44 +0200
commita32a61813ebaecf0c1e69fd1481bf09d8c8b1420 (patch)
treeecfb6140075e3c46b599755e220dbf560de2e31d /doc/language.tex
parent51e2f98e33ae10fc3052335cc6847bc93d0784fa (diff)
downloadelna-a32a61813ebaecf0c1e69fd1481bf09d8c8b1420.tar.gz
Support more floating point literals
Diffstat (limited to 'doc/language.tex')
-rw-r--r--doc/language.tex12
1 files changed, 8 insertions, 4 deletions
diff --git a/doc/language.tex b/doc/language.tex
index 04f8613..b7b8d9d 100644
--- a/doc/language.tex
+++ b/doc/language.tex
@@ -51,9 +51,10 @@ preceded by a prefix and followed by a suffix. The prefixes \verb|0x| and
indicate binary representation. Unsigned integers have the suffix \verb|u|,
signed integers have no suffix.
-A \textit{real number} always contains a decimal point. Optionally it may
-also contain a decimal scale factor. The letters \verb|e| or \verb|E| is
-pronounced as `times ten to the power of'.
+A \textit{real number} contains either a decimal point, or a scale factor,
+or both. A decimal point must be followed by at least one digit. The letter
+\verb|e| (or \verb|E|) introduces the scale factor and is pronounced
+``times ten to the power of''.
\begin{grammar}
<integer-literal> = `0' | <counting-digit> \{<decimal-digit>\}.
@@ -62,8 +63,11 @@ pronounced as `times ten to the power of'.
\alt{} `0' (`X' | `x') <hex-digit> \{<hex-digit>\}
\alt{} `0' (`B' | `b') <binary-digit> \{<binary-digit>\}.
+<scale-factor> = (`e' | `E') [`+' | `-'] <decimal-digit> \{<decimal-digit>\}.
+
<real-literal> = <integer-literal> `.\@' <decimal-digit> \{<decimal-digit>\}
- \alt{} <integer-literal>\} `e' [`+' | `-'] <decimal-digit> \{<decimal-digit>\}.
+ [<scale-factor>]
+ \alt{} <integer-literal> <scale-factor>.
\end{grammar}
Examples: