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