diff options
Diffstat (limited to 'sanctuary.fs')
| -rw-r--r-- | sanctuary.fs | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/sanctuary.fs b/sanctuary.fs index 4fe9f8c..b0867d1 100644 --- a/sanctuary.fs +++ b/sanctuary.fs @@ -14,11 +14,25 @@ : begin <mark ; immediate : again branch <resolve ; immediate : until ?branch <resolve ; immediate -: if ?branch >mark ; immediate ( I: -- a ) +: if ?branch >mark ; immediate : else branch >mark swap >resolve ; immediate : then >resolve ; immediate : while ?branch >mark ; immediate : repeat branch swap <resolve >resolve ; immediate +: ?dup dup 0<> if dup then ; + : allot here swap dp +! ; + +: ?find ?dup if find 0= if 2drop abort then else abort then ; +: 'h parse-name ?find ; +: ' 'h >body ; +: [compile] ' ( word ) compile, ; immediate +: ['] ' ( word ) [compile] literal ; immediate +: postpone 'h ( word ) dup immediate? if >body compile, + else >body [compile] literal ['] compile, compile, then ; immediate + +\ my plan is that (CREATE) is followed by a dummy zero cell +\ which (DOES>) uses. waste of 8 bytes but it's simpler +: create parse-name (header) latest ! ['] (create) compile, 0 , ; bye |
