Re: Formal spec; implementation; nesting
Paul Schlie 12 Jan 2005 02:18 UTC
Sorry, cut/pasted too quickly:
<comment> -> <datum-comment> | <quote-comment> | ; <all-chars-to-break>
<datum-comment> -> #; <datum-or-empty>
<datum-or-empty> -> <datum> | <datum-comment> | <quote-comment> | <empty>
<quote-comment> -> ' <comment-or-empty>
| ` <comment-or-empty>
| , <comment-or-empty>
| @, <comment-or-empty>
<comment-or-empty> -> <datum-comment> | <quote-comment> | <empty>
> From: Paul Schlie <xxxxxx@comcast.net>
>
>> From: Alpine Petrofsky <xxxxxx@petrofsky.org>
>>
>> I encourage anyone who would like to see different behavior
>> standardized to provide a formal specification of what he desires.
>
> This should do it, and feels somewhat simpler:
>
> <comment> -> <datum-comment> | ; <all-subsequent-chars-up-to-a-line-break>
>
> <datum-comment> -> #; <datum-or-comment>
>
> <datum-or-comment> -> <datum> | <datum-comment> | <empty>
>
> Which should satisfy the following reader scenarios:
>
> (#; <a> #; '<b>) => ()
> (<a> #; #; '<b>) => (<a>)
> (#; #; <a> '<b>) => ('<b>)
> (<a> '<b> #; #;) => (<a> '<b>)
>
> Where if it's also desired to define what ' ` , mean if applied to <empty>,
> then comment need only be extended with a definition of <quote-comment>:
>
> <comment> -> <datum-comment>
> | <quote-comment>
> | ; <all-subsequent-chars-up-to-a-line-break>
>
> <quote-comment> -> ' <empty> | ` <empty> | , <empty> | @, <empty>
>
> (although basically cheating, vs re-writing ' ` , @, patterns)
>
> Which should satisfy the following further reader scenarios:
>
> (' #; <a> ') => ()
> (' <a> #; ') => ('<a>)
>
> As although quoting <empty>, or commenting <empty> is redundant, there seems
> no good reason to generate an error; just as quoting a <literal> is also
> redundant and doesn't generate an error.