Re: Error in the SRFI-30 formal specification Martin Gasbichler 12 Jan 2003 09:30 UTC

>>>>> Almanac Petrofsky <xxxxxx@petrofsky.org> writes:

> I wrote:
>> I think the way to write the specification you intended is like this:
>>
>> <comment> ---> ; <all subsequent characters up to a line break>
>> | <srfi-30-comment>
>>
>> <srfi-30-comment> #| <comment-text> (<srfi-30-comment> <comment-text>)* |#
>>
>> <comment-text> ---> <character sequence not containing #| or |#>

> Actually, I think "the way" would be more like this:

>   <comment> ---> ; <all subsequent characters up to a line break>
>                | <srfi-30-comment>

>   <srfi-30-comment> ---> #| <srfi-30-comment-body>* |#

>   <srfi-30-comment-body> ---> <character sequence not containing #| or |#>
>                             | <srfi-30-comment>

> That eliminates the lopsidedness of srfi-30-comment, and also
> eliminates the confusing use of parentheses to indicate a BNF grouping
> rather than parentheses tokens (which is what they mean throughout
> r5rs 7.1).

But this eliminates the possibility to write

#| foo #| bar |# baz |#

i.e. the possibility to write "useful" nested comments.

I agree that the use of parentheses is unfortunate but this can be
fixed by a new non-terminal:

<comment> ---> ; <all subsequent characters up to a line break>
               | <srfi-30-comment>

<srfi-30-comment> ---> #| <comment-text> <srfi-30-comment-and-text>* |#

<srfi-30-comment-and-text> ---> <srfi-30-comment> <comment-text>

<comment-text> ---> <character sequence not containing #| or |#>

--
Martin