Implemented most vocab words.
[forth.jl.git] / src / lib_9_vocab.4th
index 68b7f6e..e4f836b 100644 (file)
 : VOCAB>LATEST ( vcfa -- vlatest )
         1+ @ @ ;
 
+: ALSO
+        context #context @ + dup 1- @ swap !
+        1 #context +!
+;
+
+\ Create new vocabulary
+: VOCABULARY
+        create 0 ,
+does>
+        body> context #context @ 1- + !
+;
+
+: DEFINITIONS
+        context #context @ 1- + @ current !
+;
+
+\ Display search order and compilation dictionary
 : ORDER
 
-    \ Search order
-    context #context @ 1- + context
-    do
-        i @ >name .name
-    loop
+        \ Search order
+        context #context @ 1- + context swap
+        do
+            i @ >name .name space
+        -1 +loop
+
+        \ Current (definitions)
+        5 spaces
+        current @ >name .name
+;
+
+\ Define root vocabulary (always available)
+vocabulary ROOT
+
+: ONLY
+        1 #context !
+        root 
+        2 #context !
+        root 
+;
 
-    \ Current (definitions)
-    9 emit
-    current @ >name .name
+: PREVIOUS
+        1 #context -!
 ;
+
+also root definitions
+
+: FORTH forth ;
+: ALSO  also ;
+: WORDS words ;
+: ORDER order ;
+
+only forth also definitions