forth: Forth-ify "(parse)"

This commit is contained in:
Virgil Dupras 2020-03-27 11:49:50 -04:00
parent 941224be94
commit edcd80e3a6
3 changed files with 8 additions and 18 deletions

Binary file not shown.

View File

@ -1123,23 +1123,7 @@ PARSED:
jp next jp next
.db "(parse)" .fill 41
.dw $-PARSED
.db 7
PARSE:
.dw compiledWord
.dw PARSED
.dw CSKIP
.dw .error
; success, stack is already good, we can exit
.dw EXIT
.error:
.dw compiledWord
.dw LIT
.db "unknown word", 0
.dw PRINT
.dw ABORT
; Indirect parse caller. Reads PARSEPTR and calls ; Indirect parse caller. Reads PARSEPTR and calls
@ -1154,7 +1138,7 @@ PARSEI:
; Spit name (in (HL)) + prev in (HERE) and adjust (HERE) and (CURRENT) ; Spit name (in (HL)) + prev in (HERE) and adjust (HERE) and (CURRENT)
; HL points to new (HERE) ; HL points to new (HERE)
.db "(entry)" .db "(entry)"
.dw $-PARSE .dw $-PARSED
.db 7 .db 7
ENTRYHEAD: ENTRYHEAD:
.dw compiledWord .dw compiledWord

View File

@ -55,6 +55,12 @@
AGAIN AGAIN
; ;
( This is only the "early parser" in earlier stages. No need
for an abort message )
: (parse)
(parsed) SKIP? ABORT
;
( ; has to be defined last because it can't be executed now ) ( ; has to be defined last because it can't be executed now )
: X ( can't have its real name now ) : X ( can't have its real name now )
['] EXIT , ['] EXIT ,