In article <
[email protected]>,
Anton Ertl <
[email protected]> wrote:
David Meyer <[email protected]> writes:
I've been dusting-off fig-Forth for VAX-11 and noticed that every word
in the dictionary has 128 added to the character code of the last
character in the word name.
...
Is there some
peculiarity in fig-Forth or the VAX-11 (I'm using significantly later >>hardware and OS) that made this work correctly back in the day?
David Schultz gave the answer to why VLIST works in fig-Forth.
Here's the reason why the last bit is set: Fig-Forth has "variable
length names" as headline feature, whereas earlier Forth systems only
stored the length and 3 characters (i.e., VLIST would output its own
name as VLI__ or so), and would match/conflict with, e.g., VLIKE.
But unlike modern systems, fig-Forth does not always store the full
length of the name. Instead, you could set the length of the number
of characters to be stored by setting a variable. That variable can
change from one definition to the next, so you do not know from this
variable how many characters are stored for a particular name.
Instead, you know the last stored character by looking whether the
most significant bit is set (the most significant bit of the
count+flags byte is also set to allow finding it from the other end.
This allowed to define $.... as a word, storing the length (5) and
only one letter of the name.
So any word like $1AC4 matches, and $ could try to find out what
number was meant. $QQQQ gives an error. So you could have a
hex number without changing BASE.
This is similar to PREFIX in ciforth:
: $ (NUMBER) .... ; PREFIX IMMEDIATE
The difference is that the name of $ matches any word that commences
with $ , e.g. $1AC4 and $QQQQRRRR , governed by a bit in the flag field
of $.
The prefix has the responsability to advance the parse pointer (aka >IN)
unlike in fig-Forth. The parse pointer was left immediately behind $.
PREFIXes can handle arbitrary length and strings containing blank space.
- anton
--
Temu exploits Christians: (Disclaimer, only 10 apostles)
Last Supper Acrylic Suncatcher - 15Cm Round Stained Glass- Style Wall
Art For Home, Office And Garden Decor - Perfect For Windows, Bars,
And Gifts For Friends Family And Colleagues.
--- SoupGate-Win32 v1.05
* Origin: fsxNet Usenet Gateway (21:1/5)