home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Power-Programmierung
/
CD1.mdf
/
forth
/
compiler
/
fpc
/
tutor
/
l1p020
< prev
next >
Wrap
Text File
|
1990-04-22
|
2KB
|
72 lines
╒═══════════════════════════════════════════════════════╕
│ Lesson 1 Part 2 F-PC 3.5 Tutorial by Jack Brown │
╘═══════════════════════════════════════════════════════╛
Enter F-PC by typing F from your C:\ root directory. ( Did you make
that file F.BAT yet?)
┌───────────────────────────────────────────┐
│ Making Our First Forth Program or Word. │
└───────────────────────────────────────────┘
We are now ready to enter our first Forth program. We are going to
teach Forth to remember our last name and phone number. If you like you
can teach Forth to remember a lot of names and phone numbers! Type the
following line:
: JACK ." BROWN" CR 10 SPACES ." 604-434-5734" ; <enter>
Press enter after the semi colon and Forth will respond with ok at the
end of the line you just entered. Now type JACK and press enter. your
screen should appear as follows:
ok
: JACK ." BROWN" CR 10 SPACES ." 604-434-5734" ; ok
JACK BROWN
604-434-5734 ok
All Forth words are separated by spaces. Forth words can consist of any
group of letters, symbols or numbers. In the above line
: JACK ." CR SPACES and ; are all Forth words.
Often Forth words come in pairs.
: and ; are a Forth word pair.
: <--- means begin a new word definition.
; <--- means end the current word definition.
." and " are another Forth word pair.
." <--- begin compiling string to be printed.
" <--- end of string to be printed.
Some words do something all by themselves and don't require
a friend to help!
CR <--- means go to the beginning of a new line.
Some forth words take a parameter or numeric argument. Note that the
parameter comes first and the word after. This is Forth's reverse polish
notation or style.
10 SPACES <enter> ok <--- output 10 spaces or blanks.
Now make some more words so that you have Forth remembering all the last
name and phone numbers of your favorite people. You can change the
spacing if you don't like mine. You can have Forth remember their
addresses if you like.
Now we are going to re-save the system with you new words! type:
FSAVE F <enter>
BYE <enter>
Enter F-PC and see if it remembers your phone list.
┌─────────────────────────────────┐
│ Please move to Lesson 1 Part 3 │
└─────────────────────────────────┘