1

Can you show the return stack in Forth?

.S shows the parameter stack. Is there a similar word showing the contents of the return stack?

I found SHOWSTACK on the web, but it does't work.

4

2 回答 2

3

I think you could use this code if you are curious about the return stack:

: RTEST RP@ DUP >R RP@ RDROP SWAP - ;

RTEST CONSTANT RSTEP
RP@ CONSTANT RBIAS

: .RETURNSTACK \ --
  RP@ RBIAS 
  DO I @ U. RSTEP
  +LOOP CR ;
于 2014-12-11T12:35:23.750 回答
1

There's no such word in ANS Forth.

As for Gforth, there is the word bt since late 2012.

于 2014-12-11T06:48:42.793 回答