Liste des Groupes | Revenir à cl forth |
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
>
Les messages affichés proviennent d'usenet.