bug-guile
[Top][All Lists]
Advanced

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

Re: Guile v. 2.0.1 does not handle escaped open parentheses correctly.


From: Ian Price
Subject: Re: Guile v. 2.0.1 does not handle escaped open parentheses correctly.
Date: Sat, 11 Jun 2011 18:23:35 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux)

Torstein Winterseth <address@hidden> writes:

> Hello,
>
> I have found a bug where Guile does not handle escaped open
> parentheses correctly. This was found in a real program which works in
> Dr. Racket in R5RS mode. You are not the only interpreter on Fedora 15
> which fails this, but anyhow.
>
> Testcase:
>
> (define bug
>  '(\())
>
> Expected results:
> No errors. bug variable should now be bound to the list (().
>
> Actual result:
> address@hidden Skrivebord]$ guile -l testcase.scm  --no-auto-compile
> ERROR: In procedure primitive-load:
> ERROR: In procedure scm_i_lreadparen:
> /home/torstein/Skrivebord/testcase.scm:3:12: end of file
>
> In the actual program the list was larger, '(\{ \[ \(), and then the error 
> was:
> ERROR: In procedure primitive-load:
> ERROR: In procedure scm_read_expression:
> /home/torstein/Skrivebord/testcase.scm:2:27: unexpected ")"

Whether or not this is a bug, I cannot say, but I would like to point
out that neither the R5RS nor the R6RS consider '\( to be a valid symbol.

I shan't quote the grammars here, but you can confirm this for yourself.
http://www.schemers.org/Documents/Standards/R5RS/HTML/r5rs-Z-H-10.html#%_sec_7.1.2
http://www.r6rs.org/final/html/r6rs/r6rs-Z-H-7.html#node_sec_4.3.1

Specifically, in the R5RS, \ is not an initial (a letter or a special
initial), nor a peculiar identifier. In the R6RS, it is not an initial
(a constituent, a special initial, or an inline hex escape) nor a
peculiar identifier.

Handling additional identifiers is done in different ways in different
Scheme implementations. '|(| is pretty common, but in guile you would use
'#{(}#. If you want portable R5RS though, you should use
(string->symbol  "(")). If you choose R6RS, you can also use hex
escapes, in this case '\x28;

Also, apologies for the double send, but I forgot to include the mailing list.

Hope that helps,
Ian




reply via email to

[Prev in Thread] Current Thread [Next in Thread]