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

Re: new, simpler formal specification



> From: Paul Schlie <schlie@xxxxxxxxxxx>
>> Taylor Campbell <campbell@xxxxxxxxxxxxxxxxxx> wrote:
>> This is the crux of your argument, and it is wrong.  A <datum> is built
>> by a stream of tokens.  Any token may be preceded by intertoken space,
>> which is ignored.  Since you have specified that <datum-comment> is
>> considered a comment, which in turn is considered intertoken space, a
>> <datum>, which begins with a token, may always be preceded by that
>> token's intertoken space, which may be a <datum-comment>.  Therefore:
>> 
>>       --- intertoken space --- (datum comment with B (from '#; A B'))
>>      /                datum    \
>>     /            vvvvvvvvvvvvvvv
>>    #;            #; A          B   C  <-- datum (token C, preceded by
>>                  ^^^^\                    intertoken space '#; #; A B')
>>                    |  \ datum (token A)
>>                     \ intertoken space (datum comment with A)
> 
> - Sorry, in a nutshell, I don't believe a left recursive grammar is
>   consistent with scheme's existing exclusively right recursive grammar;
>   and candidly still surprised anyone would, but what you advocate is:
>  
>     <datum-comment> -> #; <datum-comment*-datum>
>     <datum-comment*-datum> -> <datum-comment>* <datum>    ; left recursive
> 
>     "#; #; A B C" => "{datum-comment {datum-comment A} B} C" => "C"
> 
>   -vs-
> 
>     <datum-comment> -> #; <datum-or-datum-comment>
>     <datum-or-datum-comment> -> <datum> | <datum-comment> ; right recursive
> 
>    "#; #; A B C" => "{datum-comment {datum-comment A}} B C" => "B C"
> 
>    (as "' ' A B C" => "(quote (quote A)) B C", not "(quote (quote A) B) C")

- After more thought, agreeing the grammar: <datum-comment> -> #; <datum>
  is unfortunately naturally left recursive as it's an <intertoken-space>.

  I still believe it's inconsistent with scheme's grammar which is otherwise
  fully right recursive.  However this inconsistency can be avoided by
  forcing it's definition to be right recursive:

    <datum-comment> -> <datum-comment-token>+ <datum>
    <datum-comment-token> -> #;

  Thereby forcing the treatment of all sequential #; as being effectively
  redundant; thereby eliminating it's otherwise undesirable left recursive
  behavior. (Which otherwise results in sequential datum-comment-token's
  affecting statements beyond those immediately following them, which is
  more likely to be error prone, than intentionally desirable or useful.)

  Thereby: "#; #; A B C" => {<datum-comment> #; #; A} B C" => "B C"

  (might this please be considered)