The Forth programming language uses a stack to pass parameters between functions. Instead of given a subfunction a number as a direct information, the value is put first to the datastack and the other function is taken the value from the stack.
A special feature of Forth is to handle integer values and floating point values on different stacks. That means, it's not possible to push a float value to the datastack. While writing short programs in Forth, it's often needed to debug the codelines.
This is possible with printing out the content of the stack. If the developer sees, what's on the stack right now, he/she understands easily what's wrong with the code. Printing out the content of the stack is important for bugtracking.
After pushing two numbers to the normal datastack, it's possible to show its content. In the example, both integer numbers are printed out after entering the ā.sā command. But, if I'm pushing two float numbers to the dedicated float stack, only the last element is shown. How can I make the entire float stack visible?
gforth example.fs
1 2 .s cr \ <2> 1 2
1.0e 2.0e f. cr \ 2.
bye
.
andf.
pop the top value off the respective stack (integer, floating point)..s
andf.s
display the entire respective stack without popping values off. ā lurker