Potential R7RS small erratum: escaped identifiers

6 views
Skip to first unread message

Daphne Preston-Kendal

unread,
Feb 9, 2025, 1:29:23 PMFeb 9
to scheme-re...@googlegroups.com
We got this report on the R7RS issue tracker:
<https://codeberg.org/scheme/r7rs/issues/230>

Reproducing the content here for completeness:

> 👋 I think there might be a (rather minor) inconsistency in the grammar of R7RS-small, regarding escaped identifiers (`|foo bar|`). In "2.1 Identifiers", it says (emphasis mine):
>
>> Any character, including whitespace characters, but excluding the backslash and vertical line characters, can appear verbatim in such an identifier. In addition, characters can be specified using either an 〈inline hex escape〉 or _the same escapes available in strings_.
>
> But later in the grammar:
>
> ```
> 〈string〉 −→ " 〈string element〉* "
> 〈string element〉 −→ 〈any character other than " or \〉
> | 〈mnemonic escape〉 | \" | \\ | \|
> | \〈intraline whitespace〉*〈line ending〉
> 〈intraline whitespace〉*
> | 〈inline hex escape〉
>
>
> 〈identifier〉 −→ 〈initial〉 〈subsequent〉*
> | 〈vertical line〉 〈symbol element〉* 〈vertical line〉
> | 〈peculiar identifier〉
>
> 〈symbol element〉 −→
> 〈any character other than 〈vertical line〉 or \〉
> | 〈inline hex escape〉 | 〈mnemonic escape〉 | \|
> ```
>
> So the escapes `\\` and `\"` are missing from the `symbol element` non-terminal (though maybe only the former provides any value).

(I haven’t reviewed this yet, I’m just forwarding it on.)



Daphne

Alex Shinn

unread,
Feb 10, 2025, 1:10:00 AMFeb 10
to scheme-re...@googlegroups.com
Thanks for forwarding the issue Daphne!

Definitely \| is missing from the formal syntax.

I think the spirit of the prose in 2.1 is that "the same escapes available in strings" should be interpreted in the context of the | (vertical bar) delimiter, so support for \" is not implied.

In practice implementations are likely to allow \<char> for any <char> in general though.

--
Alex

--
You received this message because you are subscribed to the Google Groups "scheme-reports-wg1" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scheme-reports-...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/scheme-reports-wg1/20DD64CD-DCC1-4436-954A-E4E8B0495179%40nonceword.org.

Alex Shinn

unread,
Feb 11, 2025, 8:12:19 PMFeb 11
to scheme-re...@googlegroups.com
Sorry, this is already listed as errata 5: https://small.r7rs.org/wiki/R7RSSmallErrata/
Reply all
Reply to author
Forward
0 new messages