문제

What should the stack comments look like when the return stack comes into play?

: FOO  ( d2 d1 tos -- sum flag ) 
   ... ;

This word expects 5 cells and returns 2 cells, but what goes between the parentheses when the return stack is used? e.g. how would the stack comment look for this:

: BAZ  ( d2 d1 tos -- d )
   BASE @ >R >R   ( d2 d1 )
   2SWAP D-   ( d ) 
   R> DUP
   R@ BAR
   R> BONK ;
도움이 되었습니까?

해결책

The return stack effect is noted separately and prefixed with R:.

See dpANS Forth 2.2.2. As an example, the description of >R: "Execution: ( x -- ) ( R: -- x )"

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top