From 97a590fc8e2089cf757afb3a90ad61d65f9c3789 Mon Sep 17 00:00:00 2001 From: Clyne Sullivan Date: Sat, 28 Oct 2023 12:20:12 -0400 Subject: add PARSE; fixes to actually comply with all tests --- forth/core-ext.fth | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'forth/core-ext.fth') diff --git a/forth/core-ext.fth b/forth/core-ext.fth index 83dd666..0c263d9 100644 --- a/forth/core-ext.fth +++ b/forth/core-ext.fth @@ -28,7 +28,10 @@ : .( [char] ) word count type ; imm : c" state @ if ['] _jmp , here 0 , then - [char] " word + [char] " here char+ begin + key dup 3 pick <> while + over c! char+ repeat drop + swap drop here - here c! here state @ 0= if exit then dup count nip 1+ allot here rot ! @@ -38,7 +41,7 @@ : value constant ; : to ' 4 cells + state @ if postpone literal ['] ! , else ! then ; imm -: defer create does> @ execute ; +: defer create ['] exit , does> @ execute ; : defer@ >body @ ; : defer! >body ! ; : is state @ if postpone ['] postpone defer! else ' defer! then ; imm @@ -66,3 +69,8 @@ ( WORD uses HERE and must be at least 33 characters. ) : pad here 50 chars + align ; +: parse here dup >r swap begin + key? if key else dup then 2dup <> while + rot dup >r c! r> char+ swap repeat + 2drop r> tuck - ; + -- cgit v1.2.3