Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.forth > #32683
| Path | csiph.com!usenet.pasdenom.info!aioe.org!.POSTED!not-for-mail |
|---|---|
| From | "Rod Pemberton" <dont_use_email@xnothavet.cqm> |
| Newsgroups | comp.lang.forth |
| Subject | Re: Vocabularies |
| Date | Sat, 26 Jul 2014 05:40:07 -0400 |
| Organization | Aioe.org NNTP Server |
| Lines | 80 |
| Message-ID | <op.xjlmg5x46zenlw@localhost> (permalink) |
| References | <48247013-f07e-4b8d-ac47-400c8e8544e4@em7g2000vbb.googlegroups.com> <785d40db-58e4-4840-afc8-8e52807f5174@googlegroups.com> |
| NNTP-Posting-Host | CNsg4fVcCsvs3UaOgZtQCw.user.speranza.aioe.org |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=iso-8859-1; format=flowed; delsp=yes |
| Content-Transfer-Encoding | 7bit |
| X-Complaints-To | abuse@aioe.org |
| User-Agent | Opera Mail/12.16 (Linux) |
| X-Notice | Filtered by postfilter v. 0.8.2 |
| Xref | csiph.com comp.lang.forth:32683 |
Show key headers only | View raw
On Fri, 25 Jul 2014 23:30:41 -0400, chitselb <chitselb@gmail.com> wrote: > "Search-order specification and control mechanisms vary widely. The > FIG-Forth, Forth-79, polyFORTH, and Forth-83 vocabulary and search order > mechanisms are all mutually incompatible. The complete list of > incompatible mechanisms, in use or proposed, is much longer. The > ALSO/ONLY scheme described in a Forth-83 Experimental Proposal has > substantial community support. However, many consider it to be > fundamentally flawed, and oppose it vigorously. > > Recognizing this variation, this Standard specifies a new primitive set > of tools from which various schemes may be constructed. This primitive > search-order word set is intended to be a portable construction set from > which search-order words may be built, rather than a user interface. > ALSO/ONLY or the various vocabulary schemes supported by the major Forth > vendors can be defined in terms of the primitive search-order word set." > > This makes me wonder, what are the available approaches? Good question. > Considering this question in the context of my own project, I came up > with four. > > 1) no vocabularies at all, because c'mon it's only got 32K RAM or maybe > 64K on the C=64 port My understanding, which may be incomplete, is that you need at least one. Otherwise, Forth can't FIND any words to EXECUTE . > 2) Linked lists with the $81A0 word at the end of a vocabulary chain (a > 1-byte length, word name is " ", high bits are set on length byte and on > last byte of name field for TRAVERSE. Found in Blazin' Forth) I'm wondering what is the advantage of this? > 3) Vocabularies are implemented by appending a "vocab id" byte to the > end of a word and setting the "V" bit (true meaning "I belong to a > Vocabulary, take a look at the last byte in the Name Field to find out > which one") ... > 4) Implement the optional ANS Forth Search Order Wordset described at > [link] (I guess I'm calling this the "vocabulary construction kit" > approach) I haven't looked at this for my own Forth. I'd probably convert to it later on, if I think it makes sense. I clearly didn't start with this, and think it's probably not necessarily a good idea to do so. You want something which works, first. You can then fix it, once you understand why it is wrong, or should be changed. > And then if I implement vocabularies, there's the question of search > order, I'm not really sure what I want to do yet. What makes some > people hate on ONLY/ALSO ? I've never really used them before. ... > If someone put a gun to my head and said "describe your preferred > Vocabulary design NOW, in one paragraph, or I'll shoot" I would say > something like: > > Words that belong to a non-Core vocabulary get a byte appended to the > end, their length increases by one, and that limits the longest word > within a vocabulary to 30 characters in length. (approach 3). For > search order, there's a queue, maximum length 10, of bytes. FIND will > process this queue from left to right, and stop after processing a "0", > which searches the core wordlist. VOCABULARY FOO creates a new > vocabulary inside the CURRENT vocabulary, invoking FOO makes foo be the > first entry searched in the vocabulary queue, and FOO DEFINITIONS makes > foo the CURRENT vocabulary. > There are other ways than just length to reduce dictionary search time. E.g., you can use hash values to reduce string comparison, or use the first character to reject incorrect strings faster. Rod Pemberton
Back to comp.lang.forth | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Re: Vocabularies chitselb <chitselb@gmail.com> - 2014-07-25 20:30 -0700
Re: Vocabularies bruce.mcfarling@gmail.com - 2014-07-25 23:00 -0700
Re: Vocabularies "Rod Pemberton" <dont_use_email@xnothavet.cqm> - 2014-07-26 05:40 -0400
Re: Vocabularies Mark Wills <markwills1970@gmail.com> - 2014-07-26 04:29 -0700
Re: Vocabularies "Rod Pemberton" <dont_use_email@xnothavet.cqm> - 2014-07-26 07:41 -0400
Re: Vocabularies "Elizabeth D. Rather" <erather@forth.com> - 2014-07-26 13:58 +0000
Re: Vocabularies chitselb <chitselb@gmail.com> - 2014-07-26 16:13 -0700
Re: Vocabularies bruce.mcfarling@gmail.com - 2014-07-26 23:32 -0700
Re: Vocabularies chitselb <chitselb@gmail.com> - 2014-08-01 13:48 -0700
Re: Vocabularies albert@spenarnc.xs4all.nl (Albert van der Horst) - 2014-08-19 11:09 +0000
csiph-web