Skip to main content
added 213 characters in body
Source Link
Chris Dodd
  • 560
  • 1
  • 4

FORTH has two stacks -- a data stack and a return (or control) stack. The data stack is used for values, while the return stack is used for return addresses of functions and can also be used for other data. The programmer can manually move values between the two stacks and need only ensure that the value on top of the return stack is the correct return address when a function exits.

The return stack is used explicitly by the compile-words in the language to store information about loops and branches/conditions while compiling code, so its not just (or even primarily) for return addresses.

FORTH has two stacks -- a data stack and a return (or control) stack. The data stack is used for values, while the return stack is used for return addresses of functions and can also be used for other data. The programmer can manually move values between the two stacks and need only ensure that the value on top of the return stack is the correct return address when a function exits.

FORTH has two stacks -- a data stack and a return (or control) stack. The data stack is used for values, while the return stack is used for return addresses of functions and can also be used for other data. The programmer can manually move values between the two stacks and need only ensure that the value on top of the return stack is the correct return address when a function exits.

The return stack is used explicitly by the compile-words in the language to store information about loops and branches/conditions while compiling code, so its not just (or even primarily) for return addresses.

Source Link
Chris Dodd
  • 560
  • 1
  • 4

FORTH has two stacks -- a data stack and a return (or control) stack. The data stack is used for values, while the return stack is used for return addresses of functions and can also be used for other data. The programmer can manually move values between the two stacks and need only ensure that the value on top of the return stack is the correct return address when a function exits.