X-Git-Url: https://thelambdalab.xyz/gitweb/index.cgi?p=forth.jl.git;a=blobdiff_plain;f=src%2Flib_8_vocab.4th;fp=src%2Flib_8_vocab.4th;h=0000000000000000000000000000000000000000;hp=e0ba306dfcfa4c2a50cbd7e7d8c82ad8350166d1;hb=90a9b8ad41a542c3ca7d150d4d1168cb8ec97b81;hpb=56f581c25775f4244cd60d5943a5beb46a9ccafb diff --git a/src/lib_8_vocab.4th b/src/lib_8_vocab.4th deleted file mode 100644 index e0ba306..0000000 --- a/src/lib_8_vocab.4th +++ /dev/null @@ -1,86 +0,0 @@ -\ Vocabulary management - -\ Forget word and everything defined after it in compilation dict -: FORGET - BL WORD CURRENT @ FINDVOCAB ( find the word, gets the dictionary entry address ) - - 0= if - drop exit - then - - >link - - DUP @ LATEST ! ( set LATEST to point to the previous word ) -; - -: HIDE - BL WORD FIND DROP >NAME - DUP @ F_HIDDEN OR SWAP ! -; - -\ Create new vocabulary -: VOCABULARY - create 0 , -does> - body> context #context @ 1- + ! -; - -: DEFINITIONS - context #context @ 1- + @ current ! -; - -\ Define root vocabulary (always available) -vocabulary ROOT - -: ONLY - 1 #context ! - root - 2 #context ! - root -; - -: PREVIOUS - 1 #context -! -; - -: ALSO - context #context @ + dup 1- @ swap ! - 1 #context +! -; - -also root definitions - - : FORTH forth ; - - \ Display search order and compilation dictionary - : ORDER - - \ Search order - context #context @ 1- + context swap - do - i @ >name .name space - -1 +loop - - \ Current (definitions) - 5 spaces - current @ >name .name - ; - - \ Display transient vocabulary contents - : WORDS - cr - context #context @ 1- + @ - 1+ @ - BEGIN - ?DUP ( while link pointer is not 0 ) - WHILE - DUP ?HIDDEN NOT IF ( ignore hidden words ) - DUP 1+ .NAME ( but if not hidden, print the word ) - SPACE - THEN - @ ( dereference the link pointer - go to previous word ) - REPEAT - CR - ; - -only forth also definitions