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.
16 lines
639 B
Plaintext
16 lines
639 B
Plaintext
( Now we have "as late as possible" stuff. See bootstrap doc. )
|
|
: _bchk DUP 0x7f + 0xff > IF LIT" br ovfl" (print) ABORT THEN ;
|
|
: DO COMPILE 2>R H@ ; IMMEDIATE
|
|
: LOOP COMPILE (loop) H@ - _bchk C, ; IMMEDIATE
|
|
( LEAVE is implemented in low xcomp )
|
|
: LITN COMPILE (n) , ;
|
|
( gets its name at the very end. can't comment afterwards )
|
|
: _ BEGIN LIT" )" WORD S= UNTIL ; IMMEDIATE
|
|
: _ ( : will get its name almost at the very end )
|
|
(entry) 1 ( compiled ) C,
|
|
BEGIN
|
|
WORD DUP LIT" ;" S= IF DROP 0x0b , EXIT THEN
|
|
FIND IF ( is word ) DUP IMMED? IF EXECUTE ELSE , THEN
|
|
ELSE ( maybe number ) (parse) LITN THEN
|
|
AGAIN ;
|