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

Re: new draft

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.

To begin with, I apologize for an over zealous response after misreading
your revised proposal; which I misinterpreted as formalizing the treatment
of sequential #;'s non-recursively (i.e. (#; #; a b c) -> (c)), which you've
actually denoted as an error, which much better than not; but please let me
try to propose a potentially somewhat simpler and cleaner similar approach.

- It may be simplest to define comment's grammar to be fully consistent
  with the language's existing reader abbreviations who's scope is
  consistently bounded by the subsequent fully recursively parsed <S-EXP>.
  (very similar to your revised proposal, but without any recursive limit)

  Thereby: using {} to denote the lexical bound of reader command, which
  can't be determined until all subsequently encountered opened scopes
  are themselves delimited; first showing only reader quote abbreviations:

      input: '(''`(a ,@(list 1 2 3) b))
     parsed: '{ ( '{ '{ `{ ( a ,@{ ( list 1 2 3 ) } b ) } } } ) }
    returns:  (quote ( (quote (quote (qq (a (uqs (list 1 2 3)) b)))))

  Correspondingly, if comment (quote-comment for the sake of argument),
  were given the exact same recursive <s-exp> grammar scoping rules, the
  only difference would be that rather than using it's immediately
  following recursively parsed <s-exp> as it's argument, it removes it
  and itself from the parsed expression (i.e commented out):

      input: '(#;#;a b `#;,c d #;'e)
     parsed: '{ ( #;{ #;{ a } } b `{ #;{ ,{ c } } } d #;{ '{ e } } )
    returns:  (quote (b d))

  Thereby things seem nice simple and symmetric; and to make things more
  ideally consistent, just as it's clear that commenting a quote expression
  effectively removes it, quoting an comment expression should be considered
  equivalent; thereby all quote forms (including quote-comment), return
  nothing if they have no/empty arguments (i.e. r5rs grammar "empty").

  Thereby it basically falls out for free, that:

    (') -> ( '{ <empty> } ) => ()
  As would:

   `(a ,b ,) -> '{(a ,{b} ,{ <empty> }) => (qq (a (uq b)))

  Thereby consistently eliminating otherwise needless nuisance errors for
  quotes with no arguments, which seems harmless, and would be consistent.

  Ultimately requiring only a few basic tweaks to scheme's grammar:

  #; [<s-exp>|<empty>] -> {comment [<s-exp>|<empty>]} => <empty>

  ['|`|,|,@] <empty> -> {quote/qq/uq/uqs <empty} => <empty>

  Where per r5rs, essentially <empty> is implied last in any list, or
  upon file/input termination (therefore should require no further tweaks).