home .. forth .. colorforth mail list archive ..

[colorforth] Re: How is colorForth different from other Forths?


----- Original Message ----- 
From: Robert Patten
To: ColorForth@xxxxxxxxxxxxxxxxxx
Sent: Wednesday, December 10, 2003 8:54 PM
Subject: How is colorForth different from other Forths?


I  need some objective comment in this.    I am thinking of posting each
section  below separately on  Comp.lang.forth    under the subject :
 "How is colorForth different from other Forths?"   and see  what happens.
What errors  have I made?
What is still not understandable?
Any other  things need to be added?
How can I make it shorter and more readable?
----------------------------------------------------

How is colorForth different from other Forths?

     In forth the source states the initial program state.
     In colorForth  the source states the current program state. The entire
program loaded from ColorForth
source can be discarded at any time without loss of current  state.  When
source is saved the current state
is saved and when loaded,   the program created will resume with the saved
state.

     The  action of a word in forth is determined by  previous words in the
input stream ( create : does>
constant variable )
     A word  in ColorForth source  is an action object pair,   and does not
rely  on previous or following
words for its action.   The  paired actions  uses  classes of  object:
comment , name,  number,  variable or
other user defined objects. In the case of colorForth the color of the word
indicates the action. and the
graphic icons indicate  the object description.  Red name is appended to
current wordiest and associated
with the current  program entry .  Yellow word,  act now.   Yellow name
object must be in the forth (user)
wordset .   Cyan word is  defer action.   Green word is build program  by
running macro ( make)  word or
deferring forth  (user) word.     A word with no entry   is  shown  with a
"?" or  if  loading,  show block
with cursor after undefined word.

     In Forth numbers are converted to binary after they are not found in
the dictionary.
     In ColorForth source numbers are binary objects. A bit indicates
whether number is shown as decimal
or hexadecimal.   The paired action indicates number size and format.
Variable objects in the source is
the storage addresses used by  the program created when the source is
loaded.  Editing source of a running
program is not recommended.  Please  empty  ( discard  program ) or edit  a
copy of   the running  source
block  if   the program must be running,   For example:   the  editor
source.

     Testing words in  Other Forths  leave a  true/false flag on the stack
for " if  " and  other branching
words   to remove and branch on false.
   In ColorForth   previous words may set/reset,  0 and minus processor,
flags for " if  "or -if   to branch
on false.  Or a testing word  that set or reset flag which  " if  "  uses to
branch on false.   No other
branching words are necessary.

     In other Forths  a  word being defined is findable after definition
completion,   allowing a previous
definition to be included in current definition.  Making words like" begin
while repeat  again  " needed for
logic flow.
    In ColorForth the new word is findable allowing recursion by repeating
the name or  a loop if followed
by ;  A previous word named the same,  in this word list is not findable.
Name objects and  " if then  ;
" are all that is necessary for logic flow.  A red  name  can be used for
entry at any point in definition  and
" if  ; "   to exit on true at any point  in definition before " then  ; "
exit on false. " If"  is the start of the
true phrase and " then" continue or false phrase.  ";" exits definition
jumping to previous word entry or
returning to next word  entry on the return stack.

In forth " [     ] literal "  are used to  compute  a literal.
In colorForth  yellow words are used   to compute literal and the literal is
deferred  only before the next
green word.

In Forth  words like " .  ." .(  type emit dump " display a historical view
of portions of memory.
In colorForth,  any words after the last  executed show   is repeatedly
shown on the screen, overwriting
any history,  while the keyboard task accepts keys.

In forth,  a line of Text from the keyboard  is buffered  and  after the
enter key is pressed, evaluated.
In  ColorForth  each key is mapped to a word and word performed now.     At
startup  the spacebar toggles
from  text to number entry key maps,   shown in lower right of the
ColorForth window,    and puts 0  on
stack.  The "alt" key selects alternate base ( hex  or decimal)  the "n" key
negative number.   For each
digit  top of stack is multiplied by the number base and then digit added.
When finished with number
entry,   toggle "space bar" back to the  text entry keymap,  leaving number
on stack or removing the zero
if no number was entered then put a null text cell on the data stack.    Now
"alt" toggles between  two 24
character maps ( z and j keys are on the punctuation and digit  map).
Character icons are arranged in
the icon table in Hoffman order to maximize the number of icons that can be
stored in the 28 bits
available in the object field of a word.  The Hoffman index for this icon is
right shifted into the cell on top
of the stack.     Additional extenuation cells  may be needed for a  long
word.    When the  space bar is
struck the first cell of   the word is found  in the forth (user) wordset
and performed.         This word may
load ColorForth source pruning  and/or appending  the running program.  Any
word  name may be a just
in time compiler of  ColorForth source. Because the program state is in the
colorForth source,   the
program can be empty without loss of state.   When source is loaded again
the program will  resume state.
The desirable ColorForth program contains only necessary words for the
current computer activity and
emptied and built again  when current needs change. Interrupt word map or
key word map  or  yellow
word may cause program  needs to change causing the running program to be
rebuilt, providing  the new
current need.

Only name and variable class objects are appended or found in the   macro
and forth wordsets.  The
associated name's program entry address  is used in the program.. The
associated Variable source  object
address is used in program for the variable address.    Other needed  object
and source  addresses   are
compiled at load time into the program without needing wordset lookup.

The last performed word " mark"   saves the top of the macro and  forth
wordsets  and the h  ( here)
program pointer.
The word " empt" restores  them  to the last  mark state,   pruning the
program back to  the marked h.
The word " empty" must make sure the show task and any other running tasks,
interrupt  word maps,
key word maps  and  return addresses   are running words below mark.
Before " empt" is performed. to
prevent following  load words from overwriting  running program.



class of object
comment:  extend Text Cap capS
       color: white white white white
       name: label  action defer build
       color: red    yellow  cyan  green
number:     dec32bit hex32bit  dec27bit hex27bit
variable:    name32bit  user1 user2 user3


---------------------------------------------------------------------
To unsubscribe, e-mail: colorforth-unsubscribe@xxxxxxxxxxxxxxxxxx
For additional commands, e-mail: colorforth-help@xxxxxxxxxxxxxxxxxx
Main web page - http://www.colorforth.com