[GH-ISSUE #996] Symplify naming of the basic identifiers in the BNF grammar #5734

Open
opened 2026-06-15 12:16:07 -05:00 by GiteaMirror · 2 comments
Owner

Originally created by @zafarkhaja on GitHub (Jan 13, 2024).
Original GitHub issue: https://github.com/semver/semver/issues/996

According to the BNF grammar there are 3 basic types of identifiers: alphanumeric, numeric and "digital". The symbols are named as <alphanumeric identifier>, <numeric identifier> and digital id... no, just <digits>, respectively. So maybe, for the sake of brevity and consistency, we should rename the first two to just alphanumerics and numerics?

This is what it would look like as a result

...
<major> ::= <numerics>
<minor> ::= <numerics>
<patch> ::= <numerics>
...
<pre-release identifier> ::= <alphanumerics> | <numerics>
<build identifier> ::= <alphanumerics> | <digits>
...
Originally created by @zafarkhaja on GitHub (Jan 13, 2024). Original GitHub issue: https://github.com/semver/semver/issues/996 According to the BNF grammar there are 3 basic types of identifiers: alphanumeric, numeric and "digital". The symbols are named as `<alphanumeric identifier>`, `<numeric identifier>` and ~digital id~... no, just `<digits>`, respectively. So maybe, for the sake of brevity and consistency, we should rename the first two to just `alphanumerics` and `numerics`? This is what it would look like as a result ``` ... <major> ::= <numerics> <minor> ::= <numerics> <patch> ::= <numerics> ... <pre-release identifier> ::= <alphanumerics> | <numerics> <build identifier> ::= <alphanumerics> | <digits> ... ```
Author
Owner

@ghost commented on GitHub (Jun 10, 2024):

This was not me please track and remove these people

<!-- gh-comment-id:2157007759 --> @ghost commented on GitHub (Jun 10, 2024): This was not me please track and remove these people
Author
Owner

@myfonj commented on GitHub (Apr 9, 2025):

I'm not sure about either of your claims:

According to the BNF grammar there are 3 basic types of identifiers: alphanumeric […]

Can you point to some source? How are they defined actually? Does alphanumeric[s] enforce mix of letters and digits? Does it tell anything about leading zeroes? Or hyphens? I am afraid you are referring to some "advanced" flavour, or specific implementation (?) and implicating that would potentially lead to confusion.

<pre-release identifier> ::= <alphanumerics> | <numerics>

This seems to be effectively quite far from what the current BNF tells:

BNF (fragment)
<pre-release identifier> ::= <alphanumeric identifier>
                           | <numeric identifier>

<alphanumeric identifier> ::= <non-digit>
                            | <non-digit> <identifier characters>
                            | <identifier characters> <non-digit>
                            | <identifier characters> <non-digit> <identifier characters>

<numeric identifier> ::= "0"
                       | <positive digit>
                       | <positive digit> <digits>

<identifier characters> ::= <identifier character>
                          | <identifier character> <identifier characters>

<identifier character> ::= <digit>
                         | <non-digit>

<non-digit> ::= <letter>
              | "-"

<digits> ::= <digit>
           | <digit> <digits>

<digit> ::= "0"
          | <positive digit>

<positive digit> ::= "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9"

<letter> ::= "A" | "B" | "C" | "D" | "E" | "F" | "G" | "H" | "I" | "J"
           | "K" | "L" | "M" | "N" | "O" | "P" | "Q" | "R" | "S" | "T"
           | "U" | "V" | "W" | "X" | "Y" | "Z" | "a" | "b" | "c" | "d"
           | "e" | "f" | "g" | "h" | "i" | "j" | "k" | "l" | "m" | "n"
           | "o" | "p" | "q" | "r" | "s" | "t" | "u" | "v" | "w" | "x"
           | "y" | "z"

This (IIUC) allows pre-release (the part after the - hyphen) to be 010, but not 001. (Interestingly, it also allows it to be ---; making 0.0.0-- and 0.0.0-00- valid SemVer 2.0.0)

Would your proposed simplification preserve that? Or do you suggest relaxing it further in the spec?

<!-- gh-comment-id:2789968132 --> @myfonj commented on GitHub (Apr 9, 2025): I'm not sure about either of your claims: > According to the BNF grammar there are 3 basic types of identifiers: `alphanumeric` […] Can you point to some source? How are they defined actually? Does `alphanumeric[s]` enforce mix of letters and digits? Does it tell anything about leading zeroes? Or hyphens? I am afraid you are referring to some "advanced" flavour, or specific implementation (?) and implicating that would potentially lead to confusion. > `<pre-release identifier> ::= <alphanumerics> | <numerics>` This seems to be effectively quite far from what the current BNF tells: <details open><summary>BNF (fragment)</summary> ```BNF <pre-release identifier> ::= <alphanumeric identifier> | <numeric identifier> <alphanumeric identifier> ::= <non-digit> | <non-digit> <identifier characters> | <identifier characters> <non-digit> | <identifier characters> <non-digit> <identifier characters> <numeric identifier> ::= "0" | <positive digit> | <positive digit> <digits> <identifier characters> ::= <identifier character> | <identifier character> <identifier characters> <identifier character> ::= <digit> | <non-digit> <non-digit> ::= <letter> | "-" <digits> ::= <digit> | <digit> <digits> <digit> ::= "0" | <positive digit> <positive digit> ::= "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9" <letter> ::= "A" | "B" | "C" | "D" | "E" | "F" | "G" | "H" | "I" | "J" | "K" | "L" | "M" | "N" | "O" | "P" | "Q" | "R" | "S" | "T" | "U" | "V" | "W" | "X" | "Y" | "Z" | "a" | "b" | "c" | "d" | "e" | "f" | "g" | "h" | "i" | "j" | "k" | "l" | "m" | "n" | "o" | "p" | "q" | "r" | "s" | "t" | "u" | "v" | "w" | "x" | "y" | "z" ``` </details> This (IIUC) allows pre-release (the part after the `-` hyphen) to be `010`, but **not** `001`. (Interestingly, it also allows it to be `---`; making `0.0.0--` and `0.0.0-00-` valid SemVer 2.0.0) Would your proposed simplification preserve that? Or do you suggest relaxing it further in the spec?
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/semver#5734