mirror of
https://github.com/hsoft/collapseos.git
synced 2024-12-26 07:08:04 +11:00
3aa681ceca
The ":" now takes care of scanning for ";". Conceptually, having ";" as an immediate word is slightly simpler than the approach in this commit, but when bootstrapping is involved, this simpler approach gets murkier. Moreover, it got even murkier-er when trying to de-stabilize EXIT, so here we are.
17 lines
406 B
Plaintext
17 lines
406 B
Plaintext
: IF ( -- a | a: br cell addr )
|
|
COMPILE (?br) H@ 1 ALLOT ( br cell allot )
|
|
; IMMEDIATE
|
|
: THEN ( a -- | a: br cell addr )
|
|
DUP H@ -^ _bchk SWAP ( a-H a ) C!
|
|
; IMMEDIATE
|
|
: ELSE ( a1 -- a2 | a1: IF cell a2: ELSE cell )
|
|
COMPILE (br)
|
|
1 ALLOT
|
|
[COMPILE] THEN
|
|
H@ 1- ( push a. 1- for allot offset )
|
|
; IMMEDIATE
|
|
: LIT"
|
|
COMPILE (s) H@ 0 C, ,"
|
|
DUP H@ -^ 1- ( a len ) SWAP C!
|
|
; IMMEDIATE
|