[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Formal spec; implementation; nesting



> From: Alpine Petrofsky <al@xxxxxxxxxxxxx>
> 
> 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.