"Jenny Brien" <jennybrien@[EMAIL PROTECTED]
> a écrit dans le message de news:
b812579f-b339-4c83-b45a-0c17afbb13b4@[EMAIL PROTECTED]
Apr 26, 8:21 pm, <Montesquiou> wrote:
> Bonjour to all,
>
> In the archive of the group, I found the word "?PAIRS"
> as in
>
> : ENDCASE 4 ?PAIRS COMPILE DROP
> BEGIN SP@[EMAIL PROTECTED]
CSP @[EMAIL PROTECTED]
= 0=
> WHILE 2 [COMPILE ENDIF REPEAT
> CSP ! ; IMMEDIATE
>
> According the FAQ, the ?PAIRS word was FIG-Forth's way of implementing a
> small amount of syntax checking.
>
> Is "Number ?PAIRS" similar to ... over <> if (error message) then ...;
>
> Thanks for the help.
Yes, except that you don't need the OVER.
Evidently CASE in this implementation leaves 4 on the stack at compile
time, and IF leaves 2, which is removed by "2 ?PAIRS" in the
definition of ENDIF. CSP is set equal to SP@[EMAIL PROTECTED]
(the address of the stack
pointer) by : and checked for equality by ; to ensure that control
structures are balanced.
Thank you, now it is clear.


|