X-Git-Url: https://thelambdalab.xyz/gitweb/index.cgi?a=blobdiff_plain;f=src%2Flib_1_basic.4th;h=a5bb701d44396297c729c2e234546038dc6d7fea;hb=HEAD;hp=dc8c584cad30da9f1904960f90f1f75afe19cc68;hpb=4db66d36d79a44ae2c32443c06b3ddad84cae531;p=forth.jl.git diff --git a/src/lib_1_basic.4th b/src/lib_1_basic.4th index dc8c584..a5bb701 100644 --- a/src/lib_1_basic.4th +++ b/src/lib_1_basic.4th @@ -36,17 +36,22 @@ : C@ @ ; : C, , ; +\ Retrieve stack depth : DEPTH PSP@ PSP0 - ; +\ Words for whitespace : '\n' 10 ; : BL 32 ; : CR '\n' emit ; : SPACE BL emit ; +\ CFA retrieval : ' BL WORD FIND DROP ; : ['] IMMEDIATE LIT LIT , ' , ; +\ Compilation + : [COMPILE] IMMEDIATE ' , ; : COMPILE IMMEDIATE LIT LIT , ' , LIT , , ; @@ -59,12 +64,14 @@ ['] LIT , , ; -: LATEST - CURRENT @ ; +\ Convert vocabulary CFA to link addr it contains +: VOCAB>LATEST + 1+ @ +; +\ Compile in recursive call to current word : RECURSE IMMEDIATE - LATEST @ \ LATEST points to the word being compiled at the moment - LFA>CFA \ get the codeword + CURRENT @ VOCAB>LATEST + LINK> \ get the codeword , \ compile it ; -