3 ms·
> I've never seen a production compiler use anything except decimal points. There's a distinction between literals used in programming languages and how variou
by wyldfire 11y ago
> I've never seen a production compiler use anything except decimal points.
There's a distinction between literals used in programming languages and how various input/output routines emit different numerals. Most programming languages follow the convention: a '.' for a radix symbol and no thousands separator. Many programming languages also include: explicit '.' implies a floating-point numeral, scientific notation support. Most modern programming languages (and even some older ones) have standard library or extremely popular library support for localization. That localization will customize things like the radix and thousands separator.
Some languages support custom literals, so you probably could adapt it to match your locale if the grammar doesn't somehow become ambiguous.
Other interesting stuff literals sometimes include: different numeral bases, signedness, precision.
It doesn't seem confusing to me, but I'll admit that there have probably been many times that I could take advantage of the programming languages' support for parsing literal numerals whose format happens to match my locale's (en_US.*).