Very nice!
Which Forth source are you using?
How to view a list of defined words? I've tried WORDS and VLIST, without success.
I found a bug: 16384 2 * . gives --.)*(
Thanks - such a simple test too that I didn't try :-).
The default cell size is 16 bits and signed so this calculation is on these limits (note 16383 2 * . works). I'm not sure how FORTH typically handles this but it may not be consistent with all implementations. I will have a look into it though.
I have noticed that many FORTH implementations don't have a standard way of listing words and this implementation doesn't include one either.
What is the defacto standard for this? I've also noticed some list new words and some list all.
I will look at adding this pending some research and further feedback.
The implementation is based on lbForth.
Thanks for your feedback.
(09-28-2022 11:52 PM)Helix Wrote: [ -> ]Very nice!
Which Forth source are you using?
How to view a list of defined words? I've tried WORDS and VLIST, without success.
I found a bug: 16384 2 * . gives --.)*(
BTW, I have built a version using 32 bit default cell size which is much nicer for calculations but the memory use/management blew out and the code comments suggest it expects 16 bits so I'm not sure it will fully cope with the larger size (ie may introduce further bugs/issues as this wasn't expected).
(09-28-2022 11:52 PM)Helix Wrote: [ -> ]Very nice!
Which Forth source are you using?
How to view a list of defined words? I've tried WORDS and VLIST, without success.
I found a bug: 16384 2 * . gives --.)*(
(09-29-2022 12:09 AM)dmh Wrote: [ -> ]The default cell size is 16 bits and signed so this calculation is on these limits (note 16383 2 * . works). I'm not sure how FORTH typically handles this but it may not be consistent with all implementations. I will have a look into it though.
I have several Forth systems that I can test with Dosbox, and they all give -32768 as a result for this operation, which seems logical.
The standard however doesn’t precise the behavior, if I understand correctly: https://forth-standard.org/standard/core/Times
(09-29-2022 12:09 AM)dmh Wrote: [ -> ]I have noticed that many FORTH implementations don't have a standard way of listing words and this implementation doesn't include one either.
What is the defacto standard for this? I've also noticed some list new words and some list all.
I don't know how lbforth is built. I see that WORDS is defined in this file: https://github.com/larsbrinkhoff/lbForth.../tools.fth
Does that mean that only a few words are available, and that other words must be compiled?
I've noticed that when Forth is terminated with BYE, all definitions are lost. Maybe it's expected, but it's not convenient
Here is WORDS. I'll add it to the next update. In the meantime add to string before starting FORTH:
Code:
: WORDS HERE CELL - @ BEGIN DUP CELL + DUP 1+ SWAP C@ 31 AND TYPE SPACE @ DUP @ 0= UNTIL CELL + DUP 1+ SWAP C@ 31 AND TYPE ;
The result you get makes sense but from further research (not just FORTH) it appears the result for this is undefined which means anything could be returned I guess.
Yes, state isn't saved when you quit (BYE), as per original version, sorry. I guess I would add everything to the load string but that doesn't help while you are developing something interactively.
Options I guess are saving the actual memory state or decompiling it back to a string to put on the stack. First option sounds easier :-)
Although the result is undefined, the following will give the result you expect / seems logical and I'll update in the next version.
Code:
: .POS BASE @ /MOD ABS ?DUP IF RECURSE THEN ABS .DIGIT ;
: . .SIGN DUP IF .POS ELSE .DIGIT THEN ;
: . . SPACE ;
(09-28-2022 11:52 PM)Helix Wrote: [ -> ]Very nice!
Which Forth source are you using?
How to view a list of defined words? I've tried WORDS and VLIST, without success.
I found a bug: 16384 2 * . gives --.)*(
(09-30-2022 07:11 AM)dmh Wrote: [ -> ]Here is WORDS. I'll add it to the next update. In the meantime add to string before starting FORTH:
Code:
: WORDS HERE CELL - @ BEGIN DUP CELL + DUP 1+ SWAP C@ 31 AND TYPE SPACE @ DUP @ 0= UNTIL CELL + DUP 1+ SWAP C@ 31 AND TYPE ;
Thank you!
It works, but only a part of the list is displayed. I could certainly try to modify this defenition, but I guess you are more familiar with Forth than me.
The list looked complete to me but scrolled off the top of the screen. Did you see it scroll?
Also, I noticed the lbForth link you posted is a totally different lbForth so the definitions won’t be the same. This one is designed to be small and portable.
(09-30-2022 07:11 AM)dmh Wrote: [ -> ]Here is WORDS. I'll add it to the next update. In the meantime add to string before starting FORTH:
Code:
: WORDS HERE CELL - @ BEGIN DUP CELL + DUP 1+ SWAP C@ 31 AND TYPE SPACE @ DUP @ 0= UNTIL CELL + DUP 1+ SWAP C@ 31 AND TYPE ;
Thank you!
It works, but only a part of the list is displayed. I could certainly try to modify this defenition, but I guess you are more familiar with Forth than me.
(10-02-2022 01:50 AM)dmh Wrote: [ -> ]The list looked complete to me but scrolled off the top of the screen.
That's precisely the problem! The list scrolls too fast and can't be stopped.
So, I will reformulate my question: where can I find a complete list of available words?
(10-02-2022 01:50 AM)dmh Wrote: [ -> ]The list looked complete to me but scrolled off the top of the screen.
That's precisely the problem! The list scrolls too fast and can't be stopped.
So, I will reformulate my question: where can I find a complete list of available words?