\ For Gforth 0.6.2, latest in a series of CREATE/DOES> overlays for teaching.
\ This one uses return stack manipulations and may be somewhat harder to follow.
\ Neal Bridges, 2006. neal@quartus.net
variable lastcreated
: (does) r> lastcreated @ ! ;
: does> postpone (does) ; immediate
: create
:
0 postpone literal \ dataspace pointer
here cell+ lastcreated ! \ save the address of the next literal for DOES> to modify
0 postpone literal postpone >r
postpone ;
here lastcreated @ 2 cells - ! \ backpatch the dataspace pointer
does>
;
: >body 3 cells + @ ;