I am learning Forth and switch contexts often to look up word definitions to check the parameters.
I am considering writing a word "se" for Stack-Effects. Typing "se word" would respond with a stack effect comment from a list which I assume I'd curate.
A good design would allow me to specify the dialect in use as well as custom lists, but I plan to start with a usable subset consisting of just gForth words.
Before I begin, I'd like to ask if this has this already been done (better than I am likely to do it.) I would still do my own, but seeing a good design would be instructive.
On Monday, 13 March 2023 at 23:44:43 UTC, Van Kichline wrote:
I am learning Forth and switch contexts often to look up word definitions to check the parameters.
I am considering writing a word "se" for Stack-Effects. Typing "se word" would respond with a stack effect comment from a list which I assume I'd curate.
A good design would allow me to specify the dialect in use as well as custom lists, but I plan to start with a usable subset consisting of just gForth words.
Before I begin, I'd like to ask if this has this already been done (better than I am likely to do it.) I would still do my own, but seeing a good design would be instructive.
First, remembering stack parameters becomes easier with practice.
Second, you could also write a quick cheat-sheet. But once you know
the core-wordset off by heart you will rarely need it.
Third, for words you define yourself.... stack effects are handy when
you come back a year later to examine the code. For this you need
to write lots of 'relevent' comments.
I dont think I have ever seen such a word "se word" but I will leave that
for others to comment on.
I am learning Forth and switch contexts often to look up word definitions to check the parameters.
I am considering writing a word "se" for Stack-Effects. Typing "se word" would respond with a stack effect comment from a list which I assume I'd curate.
A good design would allow me to specify the dialect in use as well as custom lists, but I plan to start with a usable subset consisting of just gForth words.
Before I begin, I'd like to ask if this has this already been done (better than I am likely to do it.) I would still do my own, but seeing a good design would be instructive.
I am considering writing a word "se" for Stack-Effects. Typing "se word" would respond with a stack effect comment from a list which I assume I'd curate.
A good design would allow me to specify the dialect in use as well as custom lists, but I plan to start with a usable subset consisting of just gForth words.
Try
LOCATE <wordname> to display the source
or
SEE <wordname> to display the compiled code.
I am learning Forth and switch contexts often to look up word definitions to check the parameters.
I am considering writing a word "se" for Stack-Effects. Typing "se word" would respond with a stack effect comment from a
list which I assume I'd curate.
A good design would allow me to specify the dialect in use as well as custom lists, but I plan to start with a usable
subset consisting of just gForth words.
Before I begin, I'd like to ask if this has this already been done (better than I am likely to do it.) I would still do
my own, but seeing a good design would be instructive.
I am learning Forth and switch contexts often to look up word definitions to check the parameters.
I am considering writing a word "se" for Stack-Effects. Typing "se word" would respond with a stack effect comment from a list which I assume I'd curate.
A good design would allow me to specify the dialect in use as well as custom lists, but I plan to start with a usable subset consisting of just gForth words.
Before I begin, I'd like to ask if this has this already been done (better than I am likely to do it.) I would still do my own, but seeing a good design would be instructive.
On Monday, March 13, 2023 at 6:44:43 PM UTC-5, Van Kichline wrote:
I am learning Forth and switch contexts often to look up word definitions to check the parameters.
Van Kichline <vkic...@gmail.com> writes:I had failed to notice that there was a development version of gForth (of failed to realize why I would want it.)
I am considering writing a word "se" for Stack-Effects. Typing "se word" would respond with a stack effect comment from a list which I assume I'd curate.In the development version of Gforth you can type "help word" and you
A good design would allow me to specify the dialect in use as well as custom lists, but I plan to start with a usable subset consisting of just gForth words.
get the documentation for the word if it is documented, or the source
code of the word otherwise. Both include the stack effect.
E.g., "help word" outputs:
|doc/gforth.txt:8641
|'word' ( char "<chars>ccc<char>-- c-addr ) core "word"
| Skip leading delimiters. Parse ccc, delimited by char, in the parse
|area. c-addr is the address of a transient region containing the parsed |string in counted-string format. If the parse area was empty or
|contained no characters other than delimiters, the resulting string has |zero length. A program may replace characters within the counted
|string. OBSOLESCENT: the counted string has a trailing space that is
|not included in its length.
while "help .word" outputs:
|No documentation for .word, LOCATEing source
|kernel/tools.fs:111
|
|Defer word-colorize ' noop is word-colorize
|
|: .word ( n nt -- n' )
| dup >r name>string tuck 2>r
| 1+ tuck + dup cols >= IF cr drop ELSE nip THEN
| 2r> r> word-colorize drop type space default-color ;
|
|: wordlist-words ( wid -- ) \ gforth
| \G Display the contents of the wordlist wid.
| 0 swap cr ['] .word map-wordlist drop ;
|
|: words ( -- ) \ tools
| \G ** this will not get annotated. See other defn in search.fs .. **
| \G It does not work to use "wordset-" prefix since this file is glossed
with the line that starts the definition of .WORD highlighted by
colour.
- anton
--
M. Anton Ertl http://www.complang.tuwien.ac.at/anton/home.html comp.lang.forth FAQs: http://www.complang.tuwien.ac.at/forth/faq/toc.html New standard: https://forth-standard.org/
EuroForth 2022: https://euro.theforth.net
On Monday, March 13, 2023 at 6:44:43 PM UTC-5, Van Kichline wrote:I still thinks so myself. Maybe it's only the right tool for me. But that's what Forth is for (I think.)
I am learning Forth and switch contexts often to look up word definitions to check the parameters.Go for it. Will be good experience.
I am considering writing a word "se" for Stack-Effects. Typing "se word" would respond with a stack effect comment from a list which I assume I'd curate.
A good design would allow me to specify the dialect in use as well as custom lists, but I plan to start with a usable subset consisting of just gForth words.
Before I begin, I'd like to ask if this has this already been done (better than I am likely to do it.) I would still do my own, but seeing a good design would be instructive.
--
me
Sysop: | Keyop |
---|---|
Location: | Huddersfield, West Yorkshire, UK |
Users: | 300 |
Nodes: | 16 (2 / 14) |
Uptime: | 48:22:42 |
Calls: | 6,710 |
Calls today: | 3 |
Files: | 12,243 |
Messages: | 5,354,640 |
Posted today: | 1 |