* Guile v. 2.0.1 does not handle escaped open parentheses correctly.
@ 2011-05-11 14:22 Torstein Winterseth
2011-05-16 21:57 ` Andy Wingo
2011-06-11 17:23 ` Ian Price
0 siblings, 2 replies; 3+ messages in thread
From: Torstein Winterseth @ 2011-05-11 14:22 UTC (permalink / raw)
To: bug-guile
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:
[torstein@Desktor 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 ")"
--
Mvh / Kind regards
Torstein
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Guile v. 2.0.1 does not handle escaped open parentheses correctly.
2011-05-11 14:22 Guile v. 2.0.1 does not handle escaped open parentheses correctly Torstein Winterseth
@ 2011-05-16 21:57 ` Andy Wingo
2011-06-11 17:23 ` Ian Price
1 sibling, 0 replies; 3+ messages in thread
From: Andy Wingo @ 2011-05-16 21:57 UTC (permalink / raw)
To: Torstein Winterseth; +Cc: bug-guile
Hi Torstein,
On Wed 11 May 2011 16:22, Torstein Winterseth <kvikende@fsfe.org> writes:
> (define bug
> '(\())
AFAIU, \ is not actually an escaping marker in R5RS. The meaning of
your program is not defined by the R5RS, as an initial \ character on a
form is not specified. Guile treats this the same as:
However...
$ guile
scheme@(guile-user)> '\(
$1 = \
scheme@(guile-user)> 1
... )
<unnamed port>:0:0: In procedure #<procedure 18d0500 at <current input>:1:0 ()>:
<unnamed port>:0:0: Wrong type to apply: 1
Entering a new prompt. Type `,bt' for a backtrace or `,q' to continue.
scheme@(guile-user) [1]>
Not sure why it decided that it should display a prompt after the first
case; probably a bug somewhere...
But, your assumption is not correct, so this is not a bug, AFAIK. R6RS
does specify an escaping syntax, however, though it is not the one you
are assuming.
Regards,
Andy
--
http://wingolog.org/
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Guile v. 2.0.1 does not handle escaped open parentheses correctly.
2011-05-11 14:22 Guile v. 2.0.1 does not handle escaped open parentheses correctly Torstein Winterseth
2011-05-16 21:57 ` Andy Wingo
@ 2011-06-11 17:23 ` Ian Price
1 sibling, 0 replies; 3+ messages in thread
From: Ian Price @ 2011-06-11 17:23 UTC (permalink / raw)
To: Torstein Winterseth; +Cc: bug-guile
Torstein Winterseth <kvikende@fsfe.org> 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:
> [torstein@Desktor 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
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2011-06-11 17:23 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-05-11 14:22 Guile v. 2.0.1 does not handle escaped open parentheses correctly Torstein Winterseth
2011-05-16 21:57 ` Andy Wingo
2011-06-11 17:23 ` Ian Price
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).