[R6RS] draft Unicode SRFI

Marc Feeley feeley
Tue Jul 5 11:58:40 EDT 2005


On 4-Jul-05, at 1:49 AM, Michael Sperber wrote:

> Marc Feeley <feeley at iro.umontreal.ca> writes:
>
>
>> I oppose the generalization of here strings to the Perl
>> syntax, because Scheme's syntax would no longer be context free.
>>
>
> But are "vanilla" here strings context-free?

No they are not, but in a superficial way (because the keyword is chosen
by the user).  You could make it context-free by requiring the ending
keyword to be written in reverse order... but that's clearly not a good
thing for human parsers.

>   Are multi-line comments?

They are.

> (I'm actually not sure on either count, but couldn't think of how to
> do it within a few minutes.)  Why does it matter?
>

It makes writing the "read" procedure difficult, essentially you need  
the
same machinery as the #n=... #n# graph syntax (because in general you  
only
know the content of the string after backing out of the production rule
for here strings).  Moreover, think of this case:

(foo #<<END1 #<<END2 "tralala
111111111
END1
222222222
END2
scoobidoo")

foo takes 3 string parameters.  To make this work, you need to interrupt
the reading of the 3rd argument (a quoted string) to start processing
the two here strings.  This is really messy to implement and it will be
hard to understand such code.

Here's another interesing case:

(foo #<<END1 #| this stuff is commented out
xxxxx
#<<END2
yyyyy
END2
END1
|#)

What is the meaning of this?  What if "#| " is replaced with "#;("?

Marc



More information about the R6RS mailing list