The Lambda Lab
/
projects
/
forth.jl.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fixed FORGET.
[forth.jl.git]
/
src
/
lib_1_basic.4th
diff --git
a/src/lib_1_basic.4th
b/src/lib_1_basic.4th
index
40851f3
..
bc21965
100644
(file)
--- a/
src/lib_1_basic.4th
+++ b/
src/lib_1_basic.4th
@@
-36,18
+36,26
@@
: C@ @ ;
: C, , ;
: C@ @ ;
: C, , ;
+\ Retrieve stack depth
: DEPTH PSP@ PSP0 - ;
: DEPTH PSP@ PSP0 - ;
+\ Words for whitespace
: '\n' 10 ;
: BL 32 ;
: CR '\n' emit ;
: SPACE BL emit ;
: '\n' 10 ;
: BL 32 ;
: CR '\n' emit ;
: SPACE BL emit ;
+\ CFA retrieval
: ' BL WORD FIND DROP ;
: ' BL WORD FIND DROP ;
-: [COMPILE] IMMEDIATE ' , ;
: ['] IMMEDIATE
LIT LIT , ' , ;
: ['] IMMEDIATE
LIT LIT , ' , ;
+\ Compilation
+
+: [COMPILE] IMMEDIATE ' , ;
+: COMPILE IMMEDIATE
+ LIT LIT , ' , LIT , , ;
+
: LITERAL IMMEDIATE ['] LIT , , ;
: CHAR BL WORD 1+ @ ;
: LITERAL IMMEDIATE ['] LIT , , ;
: CHAR BL WORD 1+ @ ;
@@
-56,9
+64,15
@@
['] LIT , ,
;
['] LIT , ,
;
+\ Convert vocabulary CFA to link addr it contains
+: VOCAB>LATEST
+ 1+ @
+;
+
+\ Compile in recursive call to current word
: RECURSE IMMEDIATE
: RECURSE IMMEDIATE
- LATEST @ \ LATEST points to the word being compiled at the moment
-
>CFA
\ get the codeword
+ CURRENT @ VOCAB>LATEST
+
LINK>
\ get the codeword
, \ compile it
;
, \ compile it
;