From 68fb553332f582f5f910fd346e0dd4de80346d67 Mon Sep 17 00:00:00 2001
From: Reid Spencer
Date: Wed, 4 May 2005 15:43:40 +0000
Subject: [PATCH] Correct the descriptions of WHILE...END and RROT. Thanks to
Lalo Martins for pointing out these errors.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21683 91177308-0d34-0410-b5e6-96231b3b80d8
---
docs/Stacker.html | 38 +++++++++++++++++++++-----------------
1 file changed, 21 insertions(+), 17 deletions(-)
diff --git a/docs/Stacker.html b/docs/Stacker.html
index 04b796b1122..bdd41bbfe59 100644
--- a/docs/Stacker.html
+++ b/docs/Stacker.html
@@ -787,7 +787,7 @@ using the following construction:
RROT |
RROT |
- w1 w2 w3 -- w2 w3 w1 |
+ w1 w2 w3 -- w3 w1 w2 |
Reverse rotation. Like ROT, but it rotates the other way around.
Essentially, the third element on the stack is moved to the top
of the stack. |
@@ -946,24 +946,28 @@ using the following construction:
executed. In either case, after the (words....) have executed, execution continues
immediately following the ENDIF.
-WHILE (words...) END |
- WHILE (words...) END |
+
WHILE word END |
+ WHILE word END |
b -- b |
- The boolean value on the top of the stack is examined. If it is non-zero then the
- "words..." between WHILE and END are executed. Execution then begins again at the WHILE where another
- boolean is popped off the stack. To prevent this operation from eating up the entire
- stack, you should push on to the stack (just before the END) a boolean value that indicates
- whether to terminate. Note that since booleans and integers can be coerced you can
- use the following "for loop" idiom:
- (push count) WHILE (words...) -- END
+ | The boolean value on the top of the stack is examined (not popped). If
+ it is non-zero then the "word" between WHILE and END is executed.
+ Execution then begins again at the WHILE where the boolean on the top of
+ the stack is examined again. The stack is not modified by the WHILE...END
+ loop, only examined. It is imperative that the "word" in the body of the
+ loop ensure that the top of the stack contains the next boolean to examine
+ when it completes. Note that since booleans and integers can be coerced
+ you can use the following "for loop" idiom:
+ (push count) WHILE word -- END
For example:
- 10 WHILE DUP >d -- END
- This will print the numbers from 10 down to 1. 10 is pushed on the stack. Since that is
- non-zero, the while loop is entered. The top of the stack (10) is duplicated and then
- printed out with >d. The top of the stack is decremented, yielding 9 and control is
- transfered back to the WHILE keyword. The process starts all over again and repeats until
- the top of stack is decremented to 0 at which the WHILE test fails and control is
- transfered to the word after the END. |
+ 10 WHILE >d -- END
+ This will print the numbers from 10 down to 1. 10 is pushed on the
+ stack. Since that is non-zero, the while loop is entered. The top of
+ the stack (10) is printed out with >d. The top of the stack is
+ decremented, yielding 9 and control is transfered back to the WHILE
+ keyword. The process starts all over again and repeats until
+ the top of stack is decremented to 0 at which point the WHILE test
+ fails and control is transfered to the word after the END.
+
INPUT & OUTPUT OPERATORS |
--
2.34.1