zForth icon indicating copy to clipboard operation
zForth copied to clipboard

missing documentation

Open jko-teenage opened this issue 9 months ago • 4 comments

Several words in e.g. core.zf seem undocumented, and it is not so easy and fun to figure out.

jko-teenage avatar May 08 '25 08:05 jko-teenage

Right now, I am specifically trying to figure out

( memory management )

: allot h +! ; : var : ' lit , here 5 allot here swap ! 5 allot postpone ; ; : const : ' lit , , postpone ; ; : constant >r : r> postpone literal postpone ; ; : variable >r here r> postpone , constant ;

but there are probably other parts that are not obvious.

jko-teenage avatar May 08 '25 08:05 jko-teenage

allot, constant and variable are pretty much standard Forthism, a good source to learn about these is the original Forth book by LEo Brodie: https://www.forth.com/wp-content/uploads/2018/01/Starting-FORTH.pdf

Let me know if this is enough to help you!

zevv avatar May 08 '25 08:05 zevv

Hi! What I expect is that for each word, there is at least a small comment that documents the stack effects. Similar to this random Gforth snippet: : rnd ( -- x ) seed @ generator um* drop 1+ dup seed ! ;

This is especially important because zForth is non-standard, I cannot make any assumptions that words behave like standard Forth.

jko-teenage avatar May 08 '25 09:05 jko-teenage

You're right, not all of the example libraries have these comments - I'd be more than happy to take PRs for this though!

zevv avatar May 08 '25 09:05 zevv