Path: ...!news.nobody.at!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Ruvim Newsgroups: comp.lang.forth Subject: Re: single-xt approach in the standard Date: Tue, 17 Sep 2024 17:04:16 +0400 Organization: A noiseless patient Spider Lines: 75 Message-ID: References: <1a3ebf77c1ed8926d455a268e1309fe0@www.novabbs.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Injection-Date: Tue, 17 Sep 2024 15:04:17 +0200 (CEST) Injection-Info: dont-email.me; posting-host="bb6be25696ff9ecdef0cd10a258ad90b"; logging-data="3635156"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19/xJNaHeSSn5T5SXIC5aRl" User-Agent: Mozilla Thunderbird Cancel-Lock: sha1:14cPjcCKIKW/8fzPDFY6OtlJ8BE= In-Reply-To: <1a3ebf77c1ed8926d455a268e1309fe0@www.novabbs.com> Content-Language: en-US Bytes: 3409 On 2024-09-17 16:15, mhx wrote: > On Tue, 17 Sep 2024 10:54:37 +0000, Ruvim wrote: > >> Do you think that the Forth standard should recognize the classic >> single-xt approach as possible for implementing a standard Forth system? >> >> The classic single-xt approach implies that only one execution token >> (xt) is associated with a name token (nt), and only one name token is >> associated with a word (a named Forth definition). And words whose >> compilation semantics differ form default compilation semantics are >> implemented as immediate words. > > First define exactly the [new things] that can be done with an xt or an > nt. These things are well known. For "xt" — "compile,", "execute", "catch". For "nt" — "name>" (classic), "name>interpret", "name>compile", "name>string". Also, "xt" and "nt" can be passed to the words that accept "x". But it is irrelevant to my questions. The single-xt approach was used in Forth systems long before Forth-94. Should this approach be possible for a standard system? There is a point of view (which I don't share) that it is impossible to implement the standard word `s"` (from the File word set) in a standard *program*. I.e., that the following definition for `s"` is not standard compliant: : s" ( "ccc" -- sd | ) [char] " parse state @ if postpone sliteral exit then dup >r allocate throw tuck r@ move r> ; immediate This effectively means that the classic single-xt approach is impossible for a standard system. > What some of my customers tried is, by using standard words, associate > generated code sequences with an xt (nearly impossible), > or infer an nt from an xt (which is not 1-to-n [n>=3], and asymmetrical). Even in some classic single-xt systems, one xt can be associated with many nt. (of course, what is now "nt" was known as "NFA"). > A limited/qualified guarantee for the nt-xt relationship can be useful. > Example: DEFER aa  ' DROP IS aa  allows to recover the nt "DROP" from > aa's DEFER@ and it is possible to disassemble linked lists of nt's. You probably mean the *xt* "DROP" from aa's DEFER@ DEFER aa ' DROP IS aa ' aa DEFER@ \ gives xt of DROP Of cause, a standard program cannot disassemble linked lists of nt's -- Ruvim