Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@tocariimaa
Copy link
Contributor

Problem: the regex for number literals is wrong, first it uses - for negative numbers instead of ~; second, it allows 0X as the hexadecimal literal prefix (SML only supports using 0x); and third, it doesn't recognize word literals (like 0w1234 or 0wx2fe).

Solution: correct the regex.

@dkearns
Copy link
Contributor

dkearns commented Nov 7, 2025

IIRC Markus isn't really maintaining this file these days so he might be willing to hand over the reigns if you approach him about it.

Fix the regex for reals too, I had forgot about it.

Signed-off-by: tocariimaa <[email protected]>
@benknoble
Copy link
Contributor

FWIW, ~ is just an operator (well, function), no? I don't think there are negative literals in the language (and ~x is valid for a variable x). Anyway, the wrong syntax being corrected there doesn't even highlight for me, since AFAICT the - isn't included in the match.

The additions for words look good.

@dkearns
Copy link
Contributor

dkearns commented Nov 9, 2025

No it is part of the literal. The grammar uses the same production for the exponent as well.

An integer constant (in decimal notation) is an optional negation symbol (~) followed by a non-empty sequence of decimal digits 0, . . , 9. An integer constant (in hexadecimal notation) is an optional negation symbol followed by 0x followed by a non-empty sequence of hexadecimal digits 0, . . , 9 and a, . . , f. (A, . . , F may be used as alternatives for a, . . , f.)

See https://smlfamily.github.io/sml97-defn.pdf

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants