Sujet : Re: single-xt approach in the standard
De : albert (at) *nospam* spenarnc.xs4all.nl
Groupes : comp.lang.forthDate : 19. Sep 2024, 09:36:07
Autres entêtes
Organisation : KPN B.V.
Message-ID : <nnd$76c078e1$19b846f5@a9b75bae883f3910>
References : 1 2 3 4
User-Agent : trn 4.0-test77 (Sep 1, 2010)
In article <
nnd$6175d1e4$764cd6e1@f82f45a6e9247add>,
Hans Bezemer <
the.beez.speaks@gmail.com> wrote:
On 18-09-2024 12:34, Ruvim wrote:
Actually, most Forth systems are classic single-xt systems. And most
educational materials on how to implement Forth explain the classic
single-xt approach.
>
Interesting enough - considering this "dual xt" idea, 4tH has *ALWAYS*
been "dual xt". All compilation behavior is in the compiler and all
execution behavior is in the interpreter. Note 4tH *only* contains
primitives. The Forth layer is what you build with these primitives,
since both the compilation behavior and execution behavior is coded in C.
And the opposite approach. Always have default compilation semantics,
i.e. add the behaviour of an interpreted word to a compiled word.
Do not allow STATE dependant behaviour except for denotations:
single words that leave a constant or several constant(s) on
the stack, but this must be the same value for interpretation and interpretation. 1)
They are compiled as literals in compilation mode.
Do not allow to postpone denotations (use literal for that),
do not allow any other state smart words.
Forth doesn't become less powerful, only less interesting for
language lawyers.
If the compilation stack is separate, inspection of STATE
can be restricted to INTERPRET , without even a need to
be inspected by number, aka denotations.
INTERPRET could simply inspect if the stack has changed.
In compile mode, it compiles literals, instead of leaving
them on the stack.
(Chuck Moore would/should like this.)
The only reason to have dual xt if you want to do
optimisation in the compilation xt.
1) Note that a :NONAME construction is an denotation, leaving a
constant xt.
>
Hans Bezemer
>
Groetjes Albert
-- Temu exploits Christians: (Disclaimer, only 10 apostles)Last Supper Acrylic Suncatcher - 15Cm Round Stained Glass- Style WallArt For Home, Office And Garden Decor - Perfect For Windows, Bars,And Gifts For Friends Family And Colleagues.