[colorforth] colorForth Discription
- Subject: [colorforth] colorForth Discription
- From: "pattenre" <pattenre@xxxxxxxxxxx>
- Date: Wed, 25 Jun 2003 04:48:08 -0700
Please correct errors, make additions deletions sugestions until this is
correct.
Robert
My computer has a dictionary for my use.
The first list of words in the dictionary, name the
computer's machine instructions that I need. They include words that allow
information input, output and storage, basic logic and math. This list is
named macro because these words usually build their action into the
command stream.
The second list of words in the dictionary name entries, in
the command stream, that I can use at the keyboard to control
the computer. This list is Forth. Words not found in the
dictionary are flagged with a question mark? and the word source is returned
to the keyboard for me to correct the word problem and then to continue.
Some words get data, some words act on the data, some words put data away.
A very few words do all three and are called programs or applications.
Needed data is gathered to the data stack, acted on and put away or told
when no longer needed. Factoring or separating this process into simple
well named words, aids in testing understanding and simplifying and reuse
in other word definitions. A red word creates an entry into the command
stream and it's name and address is placed at the beginning of the current
word and associated address list so that it can be found. Yellow words found
in the forth word list start action now in the command stream where they
were created in red. Cyan words found in the macro or forth list and
green words found in the forth list compile their call entry into the
command stream delaying action until executed. Green words found in the
macro list are executed now probably compiling it's machine action into the
command stream for later execution. The if words split the command stream
into a true stream ; then a false stream ; The green word ; ends a command
stream by compiling a return or if the last word is a call change it to a
jump allowing loops to form in the command stream. A cyan ; will defer
ending the command stream until execution of this word definition.
Integer Littorals are computed with yellow words and taken from the stack
and put into the command stream only before the following green word.
Yellow numbers are put on the stack. Green numbers are put in the command
stream and when executed are put on the stack. Yellow and green numbers are
decimal integers, darker numbers are hexadecimal integers. White words are
comments. Magenta words define variables with the following cell in the word
stream it's value. The word stream can come from me via the keyboard or
from preedited numbered blocks of less than 256 words.
Now go forth and create your Color world.
w - white words (execute)
· r - red words (define)
· g - green words (compile)
· m - magenta words (variable)
· c - cyan words (compile macros)
· t - white (text, comment) words
· C - text words with first character capitalized
· S - text words, all caps
Colorforth is based on a Forth with a "cell sized word token" having two
parts, the name and the action. The name can be compressed to increase the
characters or uniqueness represented in the name. The action is an index
into the action table of possible actions and is placed in the lower bits
of the token for efficiency. Each action is assigned a unique color, shape,
sound, or feel depending on the needs of the user for identifing the action
of the word.
· define Red word marks here in the command stream as the execution entry
point. When the word stream is loaded, this name and address is placed at
the head of the current word and associated address list. When the word is
used again it refers to this entry point.
· execution Words in yellow are executed if found in the forth word list.
· compile Cyan words are compiled. Can be used to defer the action of
a macro word until the definition is executed.
· execute/compile If the green word is found in the macro word list, it is
executed. if found in the Forth word list it is compiled into the command
stream.
· Constant is a compiled literal and happens when there is a transition
from yellow word to a green word. Yellow words should be used to compute
the value of the literal.
---------------------------------------------------------------------
To unsubscribe, e-mail: colorforth-unsubscribe@xxxxxxxxxxxxxxxxxx
For additional commands, e-mail: colorforth-help@xxxxxxxxxxxxxxxxxx
Main web page - http://www.colorforth.com