Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement Search-Order word set #476

Open
jkotlinski opened this issue Aug 24, 2022 · 4 comments
Open

Implement Search-Order word set #476

jkotlinski opened this issue Aug 24, 2022 · 4 comments

Comments

@jkotlinski
Copy link
Owner

jkotlinski commented Aug 24, 2022

To make FIND-NAME faster: Implement the Search-Order word set, so that assembly words can be put in a separate word list and switched out when not needed. See discussion #428

@lonetech
Copy link
Contributor

It's doable. The search order property in itself mandates that word lists are searched, so we'd have to separate them. That might most easily be done by rearranging the dictionary, and as earlier shown, we can hide words by injecting an end marker. Each word list could have an address and size, and markers would duplicate the size array. One corner case is when the current compilation list isn't the first in the search order. I also would advise never to hide something deeper than a marker.

I also had an idea for not reordering the dictionary, involving a new separator indicating which wordlist a chunk of words belongs to. Thus the links for a wordlist could be amortised across multiple words. But the idea with that feature was to allow traversing the whole log while skipping inactive lists, and it helps less when following each list in order, as specified.

@jkotlinski
Copy link
Owner Author

HMM... I was thinking this would be trivial, just use multiple linked lists. But I remember now that the dictionary no longer is a linked list, for good reasons. That makes this task a lot more ugly.

One thing that COULD fairly easily be done, would be to have only two word lists: CORE and ASM. Words belonging to the ASM word list could be marked so, by setting bit 0x20 in the length byte. ASM could be optionally switched in and out by choosing to include bit 0x20 in searches or not. Now, as a speed-up, the improvement would be humble. It would maybe be more a convenience for beginners, not to have the WORDS output swamped by 100 assembly mnemonics.
Again, it is maybe not worth the extra complication.

@lonetech
Copy link
Contributor

lonetech commented Aug 25, 2022

In #428 (comment) I already implemented hiding of the asm words, but not the Search-Order word set style of control. If inserted at the right place in base.fs, only one lift would be needed (the one of pushya does>), and it wouldn't need a compiled word to do so either. However the mechanism to know how to hide or reveal must be adapted to not break when the *mi words are hidden. (The current one would work, but only after the hide list.)

I guess to match other word-list approaches the reveal word would be assembler, and previous to hide it. We essentially declare the minimal search order to include forth-wordlist. Without set-current or definitions, the assmbler wordlist will be fixed.

Most of the assembler mnemonics also have a comma in the third position. One could imagine a decision tree sort of search structure, wherein we skip the mnemonics if that comma isn't there in the search word. But that sounds like too much of a special case to me.

@lonetech
Copy link
Contributor

lonetech commented Sep 10, 2022

Minor note: the standard allows words to only list the first word list in the search order. This could be of relevance in the discussion of perhaps separating core, assembly and user words.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants