forth: fix bootstrapping issues with "LITN" and "+"

This commit is contained in:
Virgil Dupras 2020-03-30 13:50:53 -04:00
parent 395eb04fac
commit 8186511727
2 changed files with 18 additions and 7 deletions

Binary file not shown.

View File

@ -17,6 +17,12 @@
properly stabilized. properly stabilized.
4. Make sure that the words you compile are not overridden 4. Make sure that the words you compile are not overridden
by the full interpreter. by the full interpreter.
5. When using words as immediates, make sure that they're
not defined in icore or, if they are, make sure that
they contain no "_c" references.
All these rules make this unit a bit messy, but this is the
price to pay for the awesomeness of self-bootstrapping.
) )
( When referencing words from native defs or this very unit, ( When referencing words from native defs or this very unit,
@ -49,7 +55,10 @@
, ( write! ) , ( write! )
; IMMEDIATE ; IMMEDIATE
: QUIT 0 FLAGS ! _c (resRS) LIT< INTERPRET (find) DROP EXECUTE ; : QUIT
0 FLAGS ! _c (resRS)
LIT< INTERPRET (find) DROP EXECUTE
;
: ABORT _c (resSP) _c QUIT ; : ABORT _c (resSP) _c QUIT ;
@ -116,12 +125,6 @@
[ JTBL 30 + @ LITN ] [ JTBL 30 + @ LITN ]
; ;
: LITN
( JTBL+24 == NUMBER )
JTBL 24 _c + ,
,
;
: (entry) : (entry)
HERE @ ( h ) HERE @ ( h )
_c WORD ( h s ) _c WORD ( h s )
@ -159,6 +162,14 @@
_c INTERPRET _c INTERPRET
; ;
( LITN has to be defined after the last immediate usage of
it to avoid bootstrapping issues )
: LITN
( JTBL+24 == NUMBER )
JTBL 24 _c + ,
,
;
( : and ; have to be defined last because it can't be ( : and ; have to be defined last because it can't be
executed now also, they can't have their real name executed now also, they can't have their real name
right away ) right away )