How can we display colorForth in the web?

Why

There is no ASCII source code. To inspect the code we need to boot colorForth. This is a proposal how to create HTML pages automatically.

How

With Cascading Style Sheets (CSS). We can use different style sheets for screen and printer output. If the meaning of the colours change we need to modify only the style file.

Every definition starts at a new line. Definitions can wrap as the colorForth editor does.

Example

This is taken from block 24 of the colorForth revision from 07/11/01. It is created manually, so there might be errors.

macro
drop ad 1, ;
over dup 44686 3, ;
0 dup c031 2, ;
if 74 2, here ;
-if 79 2, here ;
a dup c28b 2, ;
a! ?lit if ba 1, , ; then d08b 2, drop ;
@ 85048b 3, 0 , ;
! a! 950489 3, 0, drop ;
nop 90 1, ;
- d0f7 2, ;
2* e0d1 2, ;
2/ f8d1 2, ;
push 50 1, drop ;
pop dup 58 1, ;
u+ ?lit if 681 2, , ; then 446013 3, drop ;
? ?lit a9 1, , ; 26 load forth 28 load 30 load mark empty

Text comments look like:

text
textcapitalized
textallcaps

Results

This works with Mozilla 0.9.1/Linux and Netscape 6.1/Linux and IE5/WIN98.

Netscape 4.76/Linux doesn't scale and doesn't show the background color properly.

Text only browsers like lynx and w3m show no styling at all.

What about email and news?

Using HTML for mail and news is a no-no. Use the common Forth syntax.
  1. word becomes : word
  2. word becomes word
  3. number and number become $number
  4. word becomes word outside of definitions and [ word ] inside
  5. word becomes [word]
  6. word becomes variable word number
  7. comment becomes ( comment )
macro
: drop $ad 1, ;
: over [dup] $44686 3, ;
: 0 [dup] $c031 2, ;
: if $74 2, here ;
: -if $79 2, here ;
: a [dup] $c28b 2, ;
: a! ?lit if $ba 1, , ; then $d08b 2, drop ;
: @ $85048b 3, 0 , ;
: ! a! $950489 3, 0, drop ;
: nop $90 1, ;
: - $d0f7 2, ;
: 2* $e0d1 2, ;
: 2/ $f8d1 2, ;
: push $50 1, drop ;
: pop dup $58 1, ;
: u+ ?lit if $681 2, , ; then $446013 3, drop ;
: ? ?lit $a9 1, , ;
26 load forth 28 load 30 load mark empty

variable x 0
: incx  1 [ x ] +! ;
: buff $900000 ;
: size  [ buff 8 + ] @ ;

Valid HTML 4.0! Valid CSS!

Updated: Mon Aug 20 10:14:28 CEST 2001