ForthHub/forth

SOURCE

Opened this issue · 0 comments

drom commented

The following code:

: GS1 S" SOURCE" 2DUP EVALUATE
       >R SWAP >R = R> R> = ;
T{ GS1 -> <TRUE> <TRUE> }T

Yields the error:

Error: in line: 790 T{ GS1 -> <TRUE> <TRUE> }T  expected [ 0, 0 ] to deeply equal [ -1, -1 ].

The code for SOURCE is clearly wrong: https://github.com/drom/forth/blob/9b1d208fd8c1d15619460a808c7a8b4740da03d2/lib/core.js#L223-L227

// 6.1.2216 SOURCE
    def('source', function () {
        this.dpush(this.here);
        this.dpush(this.io.last - this.io.ptr);
    }, cxt);

Clearly one of the longest ANS94 descriptions:

image


image