Commit c57c3218 authored by psf's avatar psf
Browse files

Fixes

parent f0657ef8
rustc frustration.rs && cat frustration.4th - | ./frustration
(echo "Compiling..." ; rustc frustration.rs) || exit
echo "Forth is now running."
cat frustration.4th - | ./frustration
......@@ -29,10 +29,10 @@ return-from-caller trick quite so much!
Let's explain how it works.
LINE 1 --> : rdup r> r> dup >r >r >r ;
LINE 2 --> : rdrop r> r> drop >r ;
LINE 3 --> : loop[ [ ' setup lit ] , [ ' rdrop lit ] , ; immediate
LINE 4 --> : ]loop latest @ 8 + , ; immediate
LINE 1 : rdup r> r> dup >r >r >r ;
LINE 2 : rdrop r> r> drop >r ;
LINE 3 : loop[ [ ' setup lit ] , [ ' rdrop lit ] , ; immediate
LINE 4 : ]loop latest @ 8 + , ; immediate
Line 1-4 are defining a new loop construct called loop[ ... ]loop that
makes a word tail-recursive.
......@@ -157,6 +157,8 @@ LINE 5 --> : ( loop[ key 41 = ? ret ]loop ; immediate
( Here is a riddle for you )
: :noname ( -- xt ) here @ [ ' ] , ] ; immediate
:noname drop rdrop ;
: stars ( n -- ) loop[ dup 0= ? [ , ] 1 - 42 emit ]loop ;
( How does the above code work?
......
......@@ -2137,14 +2137,18 @@ fn main() {
* You can run this Forth with:
* ./frustration
*
* However, I recommend loading a Forth program (frustration.fs, provided)
* However, I recommend loading a Forth program (frustration.4th, provided)
* which does a few more setup steps before letting you loose.
*
* cat frustration.4th - | ./frustration
*
* The line above is a good way to run Frustration if you're using Linux.
* It concatenates together frustration.fs and - (stdin). This means you
* can type commands once frustration.fs is loaded.
* It concatenates together frustration.4th and - (stdin). This means you
* can type commands once frustration.4th has been executed.
*
* There is a shell script supplied that will do all of the above for you.
*
* bash build.sh
*
* Please read frustration.4th if you want to learn more about Forth and what
* makes it a unique language.
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment