David N. Williams wrote:
> 
> Sorry for the weird subject title -- couldn't think what to call 
> this.
> 
> A problem I've been having with gforth distills to the following:
> 
> --------------
> s" [UNDEFINED]" pad c! pad char+ pad c@ move
>      pad find nip 0=
> [IF]
>    : [UNDEFINED]  ( "name" -- flag )
>      bl word find nip 0= ; immediate
> [THEN]
> 
> [UNDEFINED] (f:   [IF] : (f:  postpone ( ; immediate [THEN]
> 
> [UNDEFINED] (f:   [IF] : (f:  postpone ( ; immediate [THEN]
> 
> [UNDEFINED] f>s   [IF] : f>s  (f: r -- s: n ) f>d drop ;    [THEN]
> 
> [UNDEFINED] f>s   [IF] cr .( f>s is undefined in fileb.fs ) cr 
> [THEN]
> -------------
> 
> In my situation, the last three [UNDEFINED]'s were included from 
> another file, but that's irrelevant.
> 
> When I run this, F>S does not get defined.
> 
> Can anybody see what I'm doing wrong?

The [IF]-processor is too smart, but not smart enough.  In the "0
[IF]" case it sees a '(' and ignores everything until the next ')'
(including the [THEN]).

A workaround is to define (f: like this:

[UNDEFINED] (f:   [IF] : (f:  postpone ( ; immediate \ )
[THEN]

Since this (-parsing is against the ANS Forth specification, this is a
bug in Gforth.

- anton



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to