The Lambda Lab
/
projects
/
forth.jl.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
ebff3ca
)
Still messing around with vocabs.
author
Tim Vaughan
<tgvaughan@gmail.com>
Wed, 1 Jun 2016 13:01:04 +0000
(
01:01
+1200)
committer
Tim Vaughan
<tgvaughan@gmail.com>
Wed, 1 Jun 2016 13:01:04 +0000
(
01:01
+1200)
src/lib_9_vocab.4th
patch
|
blob
|
history
diff --git
a/src/lib_9_vocab.4th
b/src/lib_9_vocab.4th
index
68b7f6e
..
7e574b7
100644
(file)
--- a/
src/lib_9_vocab.4th
+++ b/
src/lib_9_vocab.4th
@@
-14,15
+14,45
@@
: VOCAB>LATEST ( vcfa -- vlatest )
1+ @ @ ;
: 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 @ current !
+;
+
+vocabulary root
+also root definitions
+
+: FORTH forth ;
+
+: ONLY
+ 1 #context !
+ root
+ 2 #context !
+;
+
+\ only forth
+
+\ Display search order and compilation dictionary
: ORDER
: ORDER
- \ Search order
- context #context @ 1- + context
- do
-
i @ >name .nam
e
- loop
+
\ Search order
+ context #context @ 1- + context swap
+
do
+
i @ >name .name spac
e
+
-1 +
loop
- \ Current (definitions)
- 9 emit
- current @ >name .name
+
\ Current (definitions)
+
9 emit
+
current @ >name .name
;
;