]> code.bitgloo.com Git - bitgloo/alee-forth.git/commitdiff
add [COMPILE], fix :NONAME
authorClyne Sullivan <clyne@bitgloo.com>
Fri, 27 Oct 2023 00:05:40 +0000 (20:05 -0400)
committerClyne Sullivan <clyne@bitgloo.com>
Fri, 27 Oct 2023 00:05:40 +0000 (20:05 -0400)
README.md
forth/core-ext.fth
forth/core.fth

index 8680a1837ff14b27ad5a7ad9df1b79bf2be9582d..aaae13ba3e7dcb20556753ace672e96c7fd6701c 100644 (file)
--- a/README.md
+++ b/README.md
@@ -15,7 +15,7 @@ Alee Forth uses the [Forth 2012 test suite](https://github.com/gerryjackson/fort
 **Missing** core extension words:
 
 ```
-PARSE PARSE-NAME REFILL RESTORE-INPUT S\" SAVE-INPUT SOURCE-ID [COMPILE]
+PARSE PARSE-NAME REFILL RESTORE-INPUT S\" SAVE-INPUT SOURCE-ID
 ```
 
 ## Building
index 620dd64ed6a8a67c0bbbc9efa659e78657fa8c14..7e4da068e8d11a6ebfcde52ec0663cbcb2a8fc38 100644 (file)
 
 : 2r@      ['] r> , ['] r> , ['] 2dup , ['] >r , ['] >r , ['] swap , ; imm
 
-: compile, postpone literal postpone execute ;
-: \        _source @ >in @ +
-           begin dup c@ while 0 over c! char+ repeat drop ; imm
-: again    postpone repeat ; imm
-: ?do      ['] 2dup , ['] _lit , here 0 , ['] >r , ['] = , postpone if
-           ['] 2drop , postpone 2r> ['] drop , ['] >r , ['] leave ,
-           postpone then postpone 2>r here ; imm
-
-: .(       [char] ) word count type ; imm
-: c"       state @ if ['] _jmp , here 0 , then
-           [char] " word
-           state @ 0= if exit then
-           dup count nip allot
-           here rot !
-           postpone literal ; imm
-
-: buffer:  create allot ;
-: value    constant ;
-: to       ' 4 cells + state @ if postpone literal ['] ! , else ! then ; imm
-: defer    create does> @ execute ;
-: defer@   >body @ ;
-: defer!   >body ! ;
-: is       state @ if postpone ['] postpone defer! else ' defer! then ; imm
+: compile,  postpone literal postpone execute ;
+: [compile] bl word find -1 = if , else compile, then ; imm
+: \         _source @ >in @ +
+            begin dup c@ while 0 over c! char+ repeat drop ; imm
+: again     postpone repeat ; imm
+: ?do       ['] 2dup , ['] _lit , here 0 , ['] >r , ['] = , postpone if
+            ['] 2drop , postpone 2r> ['] drop , ['] >r , ['] leave ,
+            postpone then postpone 2>r here ; imm
+
+: .(        [char] ) word count type ; imm
+: c"        state @ if ['] _jmp , here 0 , then
+            [char] " word
+            state @ 0= if exit then
+            dup count nip allot
+            here rot !
+            postpone literal ; imm
+
+: buffer:   create allot ;
+: value     constant ;
+: to        ' 4 cells + state @ if postpone literal ['] ! , else ! then ; imm
+: defer     create does> @ execute ;
+: defer@    >body @ ;
+: defer!    >body ! ;
+: is        state @ if postpone ['] postpone defer! else ' defer! then ; imm
 : action-of state @ if postpone ['] postpone defer@ else ' defer@ then ; imm
 
 : erase    0 fill ;
index a4bac26785cd1974aeb7b07a83942e22efea8f75..90a8577d32643610e6d30b5ccbc4dcb33c1c5a58 100644 (file)
            else dup emit rot 2dup c! char+ swap drop swap 1- then
            repeat drop r> - 1 chars / ;
 
-: :noname  0 , here ] ;
+: :noname  here 0 , here swap ] ;
 
 : evaluate _source @ >r _sourceu @ >r >in @ >r
            0 >in ! _sourceu ! _source ! _ev