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

Re: new, simpler formal specification

This page is part of the web mail archives of SRFI 62 from before July 7th, 2015. The new archives for SRFI 62 contain all messages, not just those from before July 7th, 2015.

On Tue, 22 Mar 2005, Paul Schlie wrote:

> In hopes it may be helpful, the following is a somewhat simpler version of
> an earlier one: http://srfi.schemers.org/srfi-62/mail-archive/msg00045.html
> which only modifies R5RS's definition of <comment> (effectively treated as
> separator/white-space); which includes <block-comment>, and removes legally
> quoting and/or commenting, a comment or <empty>:
> Only modifying one R5RS's exiting grammar specification:
>    <comment> -> <line-comment> | <block-comment> | <datum-comment>
> And augmented it with these additions:
>   <line-comment> -> ; <all-chars-to-end-of-line>
>   <block-comment> -> #| <all-char-except-#|-or-|#> |#
>   <datum-comment> -> #; <datum>

One problem with this is that it creates mutual references between
sections 7.1.1, which describes the lexical structure, and 7.1.2, which
describes the external representation of S-expressions -- in terms of a
stream of tokens.  While I find the 'stream of tokens' model very
distasteful to describe Lisp syntax, it is nevertheless how the current
framework for Scheme's syntax works, and breaking it is not a good idea
-- especially since you seem opposed to such massive changes anyway, or
at least that was the impression I got from your previous objections.

(Your block comments are also inconsistent with SRFI 30, by the way,
but that is not relevant to this SRFI.)

> (i.e. #;#; '#; (#;) (') etc. are illegal sequences, vs. earlier versions.)

Actually, with the way you just presented it, immediately nested
S-expression comments work exactly as in the current proposal.  First,
consider the text '#; A B'.  If parsed as a datum, the value will be
just B, since the '#; A' is considered intertoken space.  (This follows
straightforwardly since A is a datum, and so the text '#; A' satisfies
your <datum-comment> rule.)  So the whole of '#; A B' is one datum (as
defined in R5RS section 7.1.2).  If we then attempt to parse '#; #; A B
C' as a datum, we see that there is some intertoken space first, namely
#; followed by a single datum.  Since we determined that the text '#; A
B' qualifies as one datum, '#; #; A B' must be one datum comment, and
the only item remaining in the input stream is C.  Thus '#; #; A B C'
reads as the symbol C.