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

Re: [colorforth] color assignment


On Saturday 25 October 2003 02:02 pm, maslicke@xxxxxxxxxxx wrote:
> 0 - extension
> 1 - yellow word
> 2 - green word
> 3 - yellow short
> 4 - green short
> 5 - yellow number
> 6 - green number
> 7 - cyan word
> 8 - red word
> 9 - comment
> 10 - Capitalized
> 11 - ALL CAPS
> 12 - magenta variable

It would seem to me that extensions would be relatively rare occurances.  
Would the following arrangement produce a simpler layout?

0 - yellow word
1 - green word
2 - yellow short
3 - green short
4 - yellow number
5 - green number
6 -
7 -
8 - cyan word
9 - red word
A - magenta word
B -
C - comment
D - Comment
E - COMMENT
F - extension

The basic idea is to be able to tell generally what kind of word it is by 
examining bit patterns, thus making the type ID more arithmetically 
manipulable (modulo 2 of course).  The layout above can be explained 
using the following bit patterns:

0ttc -- interpreted or compiled word

 c: 0 = yellow (interpreted)
    1 = green (compiled)

 tt: 00 = name
     01 = short-form number
     10 = long-form number
     11 = unused

10cc -- miscellanious/"syntactical" words

 cc: 00 = cyan name
     01 = red name
     10 = magenta variable name
     11 = unused

11cc -- comment token

 cc: 00 = comment
     01 = Comment
     10 = COMMENT

1111 -- extension

That leaves a total of three types left over.

However, I'm not seeing any type for hexadecimal versus decimal 
presentation formats.  How is that handled in ColorForth?  I thought 
each had their own, unique token.

> It should be pretty obvious why the code is simpler. Given the
> color is yellow (1) or green (2), to get the color for short
> you add 2, to get the color for number you add 4.

I'm not sure why this would help.  Wouldn't something like this be best 
implemented as a jump-table?

--
Samuel A. Falvo II


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