hyln9 / ikarus

Optimizing incremental native-code compiler for R6RS scheme. This is a forked repository.
https://launchpad.net/ikarus
Other
5 stars 0 forks source link

latest fix for 'begin' causes error #266

Open hyln9 opened 10 years ago

hyln9 commented 10 years ago

Hi

I just applied the latest version of psyntax to IronScheme.

Now, when running the R6RS testsuite, I get:

Unhandled exception during evaluation: &who: list &message: "raw symbol encountered in output of macro" &syntax: form: (list 'quasiquote (list 'foo (cons 'unquote q))) subform: quasiquote

Any ideas? (not sure what is the cause yet)

Thanks

leppie

Launchpad Details: #LP456473 leppie - 2009-10-20 12:53:20 -0400

hyln9 commented 10 years ago

Same result in Ikarus:

$ ikarus --r6rs-script tests/r6rs/run.sps Unhandled exception: Condition components:

  1. &who: list
  2. &message: "raw symbol encountered in output of macro"
  3. &syntax: form: (list 'quasiquote (list 'foo (cons 'unquote q))) subform: quasiquote

Launchpad Details: #LPC leppie - 2009-10-20 13:01:58 -0400

hyln9 commented 10 years ago

Can you at least send a sample code that shows the bug?

Launchpad Details: #LPC Abdulaziz Ghuloum - 2009-10-21 01:21:28 -0400

hyln9 commented 10 years ago

This was a bug in quasiquote that has been there for a long time and the bug fix just exposed it. Fixed in 1865. Thanks.

Launchpad Details: #LPC Abdulaziz Ghuloum - 2009-10-21 01:59:20 -0400

hyln9 commented 10 years ago

Can you at least send a sample code that shows the bug?

Sorry. The code is from the PLT R6RS testsuite (from the base test IIRC).

Cheers

leppie

Launchpad Details: #LPC leppie - 2009-10-21 04:51:57 -0400

hyln9 commented 10 years ago

Quasiquote issue now gone :)

Still an issue :(

$ ikarus --r6rs-script srfi/tests/multi-dimensional-arrays.sps Unhandled exception: Condition components:

  1. &who: begin
  2. &message: "invalid syntax"
  3. &syntax: form: (begin) subform: #f
  4. &source-position: file-name: "srfi/tests/multi-dimensional-arrays.sps" character: 676
  5. &trace: #<syntax (begin) [char 676 of srfi/tests/multi-dimensional-arrays.sps]>
  6. &trace: #<syntax (past)>

Not sure if it is Derrick's include code causing that, but it used to work. All the other SRFI use cases and tests works though.

Cheers

leppie

Launchpad Details: #LPC leppie - 2009-10-21 14:43:38 -0400

hyln9 commented 10 years ago

I don't know why that code overrides the definition of past, and commenting out the binding of past in the let-syntax makes it pass all tests. Forwarding to Derick.

Launchpad Details: #LPC Abdulaziz Ghuloum - 2009-10-21 15:42:39 -0400

hyln9 commented 10 years ago

Thanks :)

Launchpad Details: #LPC leppie - 2009-10-21 16:01:23 -0400

hyln9 commented 10 years ago

On Wed, 2009-10-21 at 18:43 +0000, leppie wrote:

$ ikarus --r6rs-script srfi/tests/multi-dimensional-arrays.sps Unhandled exception: Condition components:

  1. &who: begin
  2. &message: "invalid syntax"
  3. &syntax: form: (begin) subform: #f
  4. &source-position: file-name: "srfi/tests/multi-dimensional-arrays.sps" character: 676
  5. &trace: #<syntax (begin) [char 676 of srfi/tests/multi-dimensional-arrays.sps]>
  6. &trace: #<syntax (past)>

Not sure if it is Derrick's include code causing that, but it used to work. All the other SRFI use cases and tests works though.

On Wed, 2009-10-21 at 19:42 +0000, Abdulaziz Ghuloum wrote:

I don't know why that code overrides the definition of past, and commenting out the binding of past in the let-syntax makes it pass all tests. Forwarding to Derick.

srfi/tests/multi-dimensional-arrays.sps uses its let-syntax to convert the included code to use (srfi :78 lightweight-testing). That is done instead of modifying the included file, so that the file remains identical to the file released by the author, so that diffing or patching it with updates from the author does not involve not-originally-there content.

The purpose of the let-syntax binding of past is to make the included uses of past disappear, because they are not relevant when the included code is converted. The use of past is a hack so that, if a test fails and calls error, using a debugger you can inspect the value returned by (past) to know what "stones" the program went past to know what test failed (bizarre, I know). The let-syntax-bound past transforms the uses to (begin) to make them disappear.

The new issue is the empty (begin) forms. I think they are valid, because top-level programs can have definitions and expressions intermixed and so empty (begin) forms intermixed with expressions are valid because they are valid definition forms. The following program which does that works with Ikarus revision 1865 (and works with the other R6RS systems):

$ cat top-level-begin.sps

!r6rs

(import (rnrs)) (begin) (define a 1) (begin) (define b 2) (begin) (display "one\n") (begin) (display "two\n") (begin) (display "three\n") $ ikarus --r6rs-script top-level-begin.sps one two three $

So, if that program works, then so should the intermixed empty (begin) forms in the expansion of srfi/tests/multi-dimensional-arrays.sps.

Launchpad Details: #LPC Derick Eddington - 2009-10-21 19:33:00 -0400

hyln9 commented 10 years ago

On Wed, 2009-10-21 at 16:33 -0700, Derick Eddington wrote:

On Wed, 2009-10-21 at 18:43 +0000, leppie wrote:

  1. &trace: #<syntax (begin) [char 676 of srfi/tests/multi-dimensional-arrays.sps]>
  2. &trace: #<syntax (past)>

The new issue is the empty (begin) forms.

So, if that program works, then so should the intermixed empty (begin) forms in the expansion of srfi/tests/multi-dimensional-arrays.sps.

Never mind. Top-level intermixed empty (begin) forms are not the problem. The problem is the (past) expressions, in the definition of tail, expanding into (begin) which is not a valid expression. Ikarus wasn't catching this mistake of mine before.

Launchpad Details: #LPC Derick Eddington - 2009-10-21 19:41:23 -0400

hyln9 commented 10 years ago

I re-reported the bug in srfi/tests/multi-dimensional-arrays.sps as bug #457739.

Launchpad Details: #LPC Derick Eddington - 2009-10-21 20:00:27 -0400