When you download & start
CoSy
it opens in a script you can work thru line by line . I think the
best intro vid currently is
https://www.cosy.com/CoSy/y22/HelloWorld_silent.mp4
.
CoSy's
method of documentation is particularly simple . It's inline with
the definitions in the scripts . Since few definitions are longer
than a line , many are fairly understandable just from their name
and definition.
The main ` help vocabulary , by example , in sort of hierarchical
order are
` prt Words | return all words containing
phrase
(
prt<l
prt<=l
prt>=f
prt>f
prt>l
prt>=l
prt<=f
prt<f
)
` prt<l :?? | find colon definition of word
in scripts making up CoSy & return
| the script where found and lines containing it ,
| delimited by totally empty line . Thus related
material
| and definitions may be included .
(
./CoSy/Furniture.f
| 20190203 | \/ | vocabulary found useful over the years | \/
|
: prt<f ( str tok -- PaRT_Before_First ) 2p> ss1st L@
swap take 2P> ;
: prt<=f ( str tok -- PaRT_Before_Firstincluding )
2p> ss1st R@ rho +i L@ swap take 2P> ;
: prt>=l 2p> ['] reverse on2 prt<=f reverse 2P> ;
: prt>l 2p> ['] reverse on2 prt<f reverse 2P> ;
: prt>f 2p> ss1st R@ rho +i L@ swap cut 2P> ;
: prt>=f 2p> ss1st L@ swap cut 2P> ;
: prt<=l 2p> ['] reverse on2 prt>=f reverse 2P> ;
: prt<l 2p> ['] reverse on2 prt>f reverse 2P> ;
| /\ |
)
` prt<l See | Show actual assembly code
for word
| This is unique to CoSy & only possible ( at least
simply ) in Forth
006358F8 E8 D3 8D FF FF call 2p>
006358FD 8D 76
FC
lea esi,[esi-04]
00635900 89
06
mov [esi],eax
00635902 B8 04 23 63
00
mov eax,00632304
00635907 E8 48 53 FF FF call on2
0063590C E8 73 FF FF
FF
call prt>f
00635911 E8 EE C9 FF
FF
call reverse
00635916 E9 F5 8D FF FF jmp 2P>
There is also
` ?? which returns all occurrences of a
phrase in all scripts .
And , not as integrated with
CoSy
help as would be nice , the underlying
Reva Forth help which
is internally much more complicated with the help material separated
from the definitions .
` dup Help
dup ( a -- a a ) 'inline
Context: ~
Source in: src/reva.f
Duplicate the top stack item
See also: (s0) -rot -swap .rs .s 2drop 2dup 2nip 2over 2swap
3drop 3dup 4dup ?dup _2dup _2nip depth drop nip over pick put
rdepth rot s0 stack-ops swap tuck
There are some other variations on these themes , and of course
being an open system you can always roll your own . Which when a
user/programmer community is established , any good idea can evolve
very quickly .