Create an HTML table.

 The table body should have at least three rows of three columns.
 Each of these three columns should be labelled "X", "Y", and "Z". 
 An extra column should be added at either the extreme left or the extreme right of the table that has no heading, but is filled with sequential row numbers. 
 The rows of the "X", "Y", and "Z" columns should be filled with random or sequential integers having 4 digits or less. 
 The numbers should be aligned in the same fashion for all columns.


include random.hsf
 
\ parser routines
:  totag
               [char] < PARSE pad place              \ parse input up to '<' char
                -1 >in +!                            \ move the interpreter pointer back 1 char
                pad count type  ;
 
: '"'        [char] " emit ;
: '"..'      '"'  space ;                            \ output a quote char with trailing space
 
: toquote                                            \ parse input to " then print as quoted text
              '"' [char] " PARSE pad place
              pad count type '"..' ;
 
: >          [char] > emit space  ;                  \ output the '>' with trailing space
 
\ Create some HTML extensions to the Forth interpreter
: <table>         ." <table>" cr ;          : </table>   ." </table>"  cr ;
: <table          ." <table " ;
: style="         ." style="  toquote ;
: align="         ." align="  toquote ;
: border="        ." border=" toquote ;
: width="         ." width="  toquote ;
: cellspacing="   ." cellspacing="  toquote ;
: colspacing="    ." colspacing="   toquote ;
 
: <tr>       ." <tr>" cr ;                  : </tr>      ." </tr>"  cr ;
: <td>       ." <td> "  totag  ;            : </td>      ." </td>"  cr ;
: <td        ." <td " ;
: <thead>    ." <thead>" ;                  : </thead>   ." </thead>" ;
: <th>       ." <th>" ;                     : </th>      ." </th>"  cr ;
: <th        ." <th "  ;
: <tbody     ." <tbody " ;                  : </tbody>   ." </tbody> " ;
: <caption>  cr ." <caption>"  totag  ;     : </caption> ." </caption>"  cr ;
 
\ Write the source code that generates HTML in our EXTENDED FORTH
cr
<table border=" 1" width=" 30%" >
<caption> This table was created with FORTH HTML tags</caption>
<tr>
<th align=" right" >       </th>
<th align=" right" > ." A" </th>
<th align=" right" > ." B" </th>
<th align=" right" > ." C" </th>
</tr>
<tr>
<th align=" right" >        1 . </th>
<td align=" right" > 1000 RND . </td>
<td align=" right" > 1000 RND . </td>
<td align=" right" > 1000 RND . </td>
</tr>
<tr>
<th align=" right" >        2 . </th>
<td align=" right" > 1000 RND . </td>
<td align=" right" > 1000 RND . </td>
<td align=" right" > 1000 RND . </td>
</tr>
<tr>
<th align=" right" >        3 . </th>
<td align=" right" > 1000 RND . </td>
<td align=" right" > 1000 RND . </td>
<td align=" right" > 1000 RND . </td>
</tr>
</table>
 