home *** CD-ROM | disk | FTP | other *** search
/ ARM Club 3 / TheARMClub_PDCD3.iso / hensa / programming / wimpforth_2 / !WimpForth / build < prev    next >
Encoding:
Text File  |  1995-12-21  |  1.4 KB  |  44 lines

  1. \ BUILD.F               New design for Defining Words           by Tom Zimmer
  2. \                       (As derived from FORML 1995)
  3.  
  4. cr .( Loading Experimental BUILD DO: defining wordset.. ) 
  5.  
  6. : build"        ( -<name>- )    \ the building part of a defining word
  7.                 header
  8.                 ((")) count pocket place
  9.                 pocket ?uppercase find 0= ?missing
  10.                 execute , ;
  11.  
  12. : ,word         ( -<name>- )    \ lay a word into the dictionary, aligned
  13.                 bl word count                   \ "name"
  14.                 here over 1+ allot              \ allocate the space
  15.                 place 0 c, align ;              \ lay in the name+NULL
  16.  
  17. : build         ( -<name>- )    \ makes words that define other words
  18.                 ?comp                           \ only while compiling
  19.                 compile build" ,word ; immediate
  20.  
  21. : do:           ( -<name>- )
  22.                 create hide !csp dodoes call, ] ;
  23.  
  24.  
  25. \S
  26. \ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  27. \       A simple example of the new defining word mechanism
  28. \ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  29.  
  30. \ first, define the BUILDING part of the defining word
  31.  
  32. : const         ( n1 -<name>- )
  33.                 build doconst , ;
  34.  
  35. \ later, define the EXECUTION part of the defining word
  36.  
  37. do: doconst     ( a1 -- n1 )
  38.                 @ ;
  39.  
  40. 2 const two
  41.  
  42.  
  43.  
  44.