Broken draft of vocab implementation.
[forth.jl.git] / src / lib_1_basic.4th
index 1764723..dc8c584 100644 (file)
 
 : '\n' 10 ;
 : BL 32 ;
-
-: LITERAL IMMEDIATE ['] LIT , , ;
+: CR '\n' emit ;
+: SPACE BL emit ;
 
 : ' BL WORD FIND DROP ;
+: ['] IMMEDIATE
+     LIT LIT , ' , ;
+
+: [COMPILE] IMMEDIATE ' , ;
+: COMPILE IMMEDIATE
+    LIT LIT , ' , LIT , , ;
+
+: LITERAL IMMEDIATE ['] LIT , , ;
 
 : CHAR BL WORD 1+ @ ;
 : [CHAR] IMMEDIATE
     ['] LIT , ,
 ;
 
-: CR '\n' emit ;
-: SPACE BL emit ;
-
-: [COMPILE] IMMEDIATE
-        BL WORD         \ get the next word
-        FIND DROP       \ find it in the dictionary
-        ,               \ and compile that
-;
+: LATEST
+    CURRENT @ ;
 
 : RECURSE IMMEDIATE
         LATEST @        \ LATEST points to the word being compiled at the moment
-        >CFA            \ get the codeword
+        LFA>CFA         \ get the codeword
         ,               \ compile it
 ;