• Custom xt compiler and compilation semantics (was: Extended VALUEs in F

    From Ruvim@21:1/5 to Ruvim on Mon Oct 3 17:06:03 2022
    On 2022-10-03 13:35, Ruvim wrote:
    On 2022-10-03 01:08, Krishna Myneni wrote:
    On 10/2/22 11:14, Anton Ertl wrote:
    Krishna Myneni <krishna.myneni@ccreweb.org> writes:
    On 10/2/22 00:00, Anton Ertl wrote:
    Krishna Myneni <krishna.myneni@ccreweb.org> writes:
    On 10/1/22 02:06, Anton Ertl wrote:
    SET-OPTIMIZER sets the implementation of COMPILE, ( xt -- ) for
    the current word.  A correct implementation of COMPILE, does not >>>>>>> change the semantics in any way, only the implementation of the
    semantics.
    (¹)

    So if you instead do

    [: postpone literal postpone execute ;] set-optimizer

    the behaviour stays the same.


    I not seeing the difference.
    I can put any arbitrary sequence inside the
    quotation for SET-OPTIMIZER. Then the compilation
    semantics (behavior) can be different from that
    of a word defined without SET-OPTIMIZER.
    (²)

    Yes, you can shoot yourself in the foot with SET-OPTIMIZER.  This is >>>>> Forth.  But once you have done that, COMPILE, does no longer work as >>>>> specified (and, more importantly, as used in most places where
    COMPILE, is used).



    [...]
    * COMPILE,ing the xt of N2 now does not optimize.  The result is
       correct, but not as fast as what you get with the SET-OPTIMIZER
       variant.

    [...]
    In short, I think using SET-COMPSEMP is a more transparent way of
    achieving optimization and your BROKEN-VALUE definition would be my
    preferred way to go about it.


    Probably you actually thought about something like "compile-nt"

      : compile-nt ( i*x nt -- j*x ) name>compile execute ;


    But this word cannot replace "compile," due to the following reasons:

    1. There is a common standard-compliant pattern to compile an ordinary
    word:
        ['] foo compile,
    And this pattern should remain valid.

    2. Anonymous definitions don't have associated nt (name token), and the
    only way to compile them is to use "compile,".

    BTW, in my system I associate a custom compilation procedure not with
    nt, but with xt. So, an optimized compiler can be specified for an
    anonymous definition too.

    Also, it's less confusing, since the notion of compilation semantics is
    not applicable to execution tokens. And when you set a compiler for xt,
    you cannot think like you define compilation semantics by that for some
    word at all.

    A compilation procedure for an xt shall be observably equivalent to
    apply "compile," to this xt, which in turn shall be observably
    equivalent to apply the definition (quotation)
    [: postpone literal postpone execute ;]
    to this xt.

    A definition is not a compilation procedure for an xt, if the above are
    not held.

    Thus, the behavior of a compilation procedure is well defined and
    determined by the execution semantics identified by the xt for which
    this procedure is intended — i.e., execution of code generated by this procedure shall be equivalent to execution of this xt. You have no room
    for *observable* variations. Therefore, it's impossible to *change*
    compilation semantics of some word by assign a custom compilation
    procedure to some xt.


    I think, in these terms the statements (¹) and (²) marked above should
    be more clear.






    [...]
    On a dual token system (one which provides a reference to
    interpretation semantics and a separate reference to compilation
    semantics) I want to avoid thinking about whether the compilation
    semantics are default or non-default.


    The notion of compilation semantics is only applicable to Forth words
    (named Forth definitions).

    As a user, you cannot avoid the notion of /default/ compilation
    semantics, since it's compilation semantics assigned by the system for a
    new ordinary word (e.g., for an ordinary colon definition).


    If you provide the system with a definition that should be used to
    perform the compilation semantics for some word, you still have to think whether you change the previously defined compilation semantics for this
    word or not.

    If the semantics are changed, the new semantics should be reflected in
    the documentation and tests for the word.

    If the semantics are not changed, the documentation and tests for the
    word may remain unchanged. But then, if this word is an ordinary word,
    the compilation semantics for this word can still be performed via
    "compile," without involving your definition to perform the compilation semantics for this word. You should not ignore this fact.

    If you think that "compile," can just unconditionally use your
    definition to perform the compilation semantics for the word — it's
    wrong, since your definition may consume and leave additional stack
    items, but "compile," — cannot.





    There is only "compilation
    semantics" for a word, at any given instance in time. The system
    provides compilation semantics for the word upon definition but it may
    be changed later, if desired. Similarly, for words which CREATE other
    words, there should be a mechanism for setting the compilation
    semantics of the created words immediately after creation, if desired.


    In such a case you have to eliminate execution tokens, "execute" and "compile," from your system  (i.e., make them inaccessible for a user).


    But the notion of anonymous definition and execution semantics are
    essential in Forth. It's a rock other conceptions are based on.




    --
    Ruvim

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Ruvim@21:1/5 to Krishna Myneni on Wed Oct 5 01:36:19 2022
    On 2022-10-04 01:52, Krishna Myneni wrote:
    On 10/3/22 04:35, Ruvim wrote:
    On 2022-10-03 01:08, Krishna Myneni wrote:

    1.
    On a dual token system (one which provides a reference to
    interpretation semantics and a separate reference to compilation
    semantics) I want to avoid thinking about whether the compilation
    semantics are default or non-default. There is only "compilation
    semantics" for a word, at any given instance in time. The system
    provides compilation semantics for the word upon definition but it may
    be changed later, if desired. Similarly, for words which CREATE other
    words, there should be a mechanism for setting the compilation
    semantics of the created words immediately after creation, if desired.


    In such a case you have to eliminate execution tokens, "execute" and
    "compile," from your system  (i.e., make them inaccessible for a user).


    No, a dual token system by definition contains execution tokens, one for interpretation and one for compilation. There is no suggestion that
    execution tokens should be eliminated.

    I just wanted to say that it's impossible to avoid the notion of default compilation semantics without avoiding ordinary words. I also mentioned
    this idea my another message yesterday: https://groups.google.com/g/comp.lang.forth/c/dh347IHLDtw/m/_C_XjZ60AwAJ





    2.

    Probably you actually thought about something like "compile-nt"

       : compile-nt ( i*x nt -- j*x ) name>compile execute ;


    But this word cannot replace "compile," due to the following reasons:

    1. There is a common standard-compliant pattern to compile an ordinary
    word:
         ['] foo compile,
    And this pattern should remain valid.

    2. Anonymous definitions don't have associated nt (name token), and the
    only way to compile them is to use "compile,".


    I actually have such a word in kForth (which is not presently a
    dual-token system) called "COMPILE-NAME", which performs the equivalent
    of NAME>COMPILE EXECUTE . One can still use expressions such as "['] FOO COMPILE," or " ... [ ' FOO ] LITERAL COMPILE,".

    On a dual-token system, COMPILE-NAME (or whatever name one wants to give
    it) would be guaranteed to compile the xt referencing the extra token referencing the compilation semantics of a word.

    Should it compile the xt, or perform the compilation semantics for the
    word? Sometimes these actions are different.



    The sequence "['] <name>"
    would still perform its usual action of returning the
    interpretation xt for the word, so there are no changes in this regard. '(tick) and ['] return what are expected in standard Forth.



    [...]

    NAME>COMPILE should always return the
    compilation xt, which can be independently set on a dual token system,
    or on a single token system which supports "non-default compilation semantics".


    In contrast, ticking a word on a standard system will return
    an execution token corresponding to its interpretation semantics.

    It sounds incorrectly. By this wording you revoke access to the
    identifier of the execution semantics for a word.

    Actually, ticking a word on a standard system returns the execution
    token that identifies the execution semantics for *this* word.

    If the standard does not specify execution semantics for the word then
    the returned xt (if any) identifies implementation-dependent execution semantics for this word.

    Yes, usually, this execution token is used by the system to *perform*
    the interpretation semantics for the word.

    But, for some words, this the same execution token may be also used to
    perform the compilation semantics for the word. Namely, if the word is
    an immediate word.

    Since, to perform the compilation semantics for an immediate word, its execution token shall be executed in compilation state, to perform the interpretation semantics — it shall be executed in interpretation state.

    When you refer this execution token as one corresponding to the
    interpretation semantics of a word, you also make an impression that
    executing this token performs the interpretation semantics for the word regardless of STATE. But it's false in the general case.



    --
    Ruvim

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Krishna Myneni@21:1/5 to Ruvim on Wed Oct 5 00:26:22 2022
    On 10/4/22 16:36, Ruvim wrote:
    On 2022-10-04 01:52, Krishna Myneni wrote:
    ..
    No, a dual token system by definition contains execution tokens, one
    for interpretation and one for compilation. There is no suggestion
    that execution tokens should be eliminated.

    I just wanted to say that it's impossible to avoid the notion of default compilation semantics without avoiding ordinary words. I also mentioned
    this idea my another message yesterday: https://groups.google.com/g/comp.lang.forth/c/dh347IHLDtw/m/_C_XjZ60AwAJ



    You may want to call it default compilation semantics, but on a dual
    token system I would simply think of it as initial compilation semantics assigned by the system when the word has been defined, i.e. when the
    colon definition specifies the interpretation semantics.

    Desired compilation semantics can be bound to the word at any later
    time, including by IMMEDIATE which copies the interpretation semantics
    to the compilation semantics.

    But this is simply a fine point about terminology. On any Forth system, dual-token or not, it is possible to make a definition with no semantics
    at all (no behavior in interpretation state or in compilation state), e.g.

    : MY-WORD ;

    In a dual-token system, it should be possible to subsequently set either
    or both interpretation and compilation semantics afterwards, any time
    the word can be found in the search order using FIND-NAME.





    2.

    Probably you actually thought about something like "compile-nt"

       : compile-nt ( i*x nt -- j*x ) name>compile execute ;


    But this word cannot replace "compile," due to the following reasons:

    1. There is a common standard-compliant pattern to compile an ordinary
    word:
         ['] foo compile,
    And this pattern should remain valid.

    2. Anonymous definitions don't have associated nt (name token), and the
    only way to compile them is to use "compile,".


    I actually have such a word in kForth (which is not presently a
    dual-token system) called "COMPILE-NAME", which performs the
    equivalent of NAME>COMPILE EXECUTE . One can still use expressions
    such as "['] FOO COMPILE," or " ... [ ' FOO ] LITERAL COMPILE,".

    On a dual-token system, COMPILE-NAME (or whatever name one wants to
    give it) would be guaranteed to compile the xt referencing the extra
    token referencing the compilation semantics of a word.

    Should it compile the xt, or perform the compilation semantics for the word?  Sometimes these actions are different.


    The compilation semantics of the word corresponding to nt is performed
    when COMPILE-NAME executes.




    The sequence "['] <name>" would still perform its usual action of
    returning the interpretation xt for the word, so there are no changes
    in this regard. '(tick) and ['] return what are expected in standard
    Forth.



    [...]

    NAME>COMPILE should always return the compilation xt, which can be
    independently set on a dual token system, or on a single token system
    which supports "non-default compilation semantics".


    In contrast, ticking a word on a standard system will return an
    execution token corresponding to its interpretation semantics.

    It sounds incorrectly. By this wording you revoke access to the
    identifier of the execution semantics for a word.


    Not really. In a dual-token system there are explicitly two types of
    execution semantics: "interpretation semantics" or "compilation
    semantics." It is easier to understand which one we are talking about.
    In contrast, for a traditional system, we have to determine whether the
    single xt representing execution semantics for a word corresponds to compilation semantics or to interpretation semantics by checking the
    precedence flag for the word.

    ..
    Yes, usually, this execution token is used by the system to *perform*
    the interpretation semantics for the word.

    But, for some words, this the same execution token may be also used to perform the compilation semantics for the word. Namely, if the word is
    an immediate word.

    Since, to perform the compilation semantics for an immediate word, its execution token shall be executed in compilation state, to perform the interpretation semantics — it shall be executed in interpretation state.

    When you refer this execution token as one corresponding to the interpretation semantics of a word, you also make an impression that executing this token performs the interpretation semantics for the word regardless of STATE. But it's false in the general case.


    Note that I said "usually" in referring to the xt on a traditional Forth
    system as representing the interpretation semantics. This is because
    there are far fewer immediate words in a typical Forth program or in the standard set of words than those which are not.

    Your points above about execution token not always representing the interpretation semantics are valid for a traditional Forth system, but
    when you tick a word name, how do you know which semantics are being
    returned? In contrast, with the sequence "nt NAME>INTERPRET" or "nt NAME>COMPILE", you know precisely to which semantics the result corresponds.

    The notion of a word having two execution tokens, xt-interp and xt-comp,
    is far more flexible way of achieving precise behavior of words in a
    Forth system than the single execution token method. It is also simpler
    to understand (unless you have been exposed to the single xt system with
    its precedence flag; then you have to unlearn this convoluted way of
    doing things). One can use the same word in both interpretation and
    compilation state without side effects associated with state-smartness.
    A particular example of where this is important is array indexing, e.g.

    A{ I }

    with the indexing word "}" -- one needs "}" to work in both the
    interpreter and from within a definition, but the compilation semantics
    usually need to be different from the interpretation semantics to obtain
    the best possible efficiency.

    --
    Krishna

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From none) (albert@21:1/5 to krishna.myneni@ccreweb.org on Wed Oct 5 11:04:48 2022
    In article <thj4hv$2tjb2$4@dont-email.me>,
    Krishna Myneni <krishna.myneni@ccreweb.org> wrote:
    On 10/4/22 16:36, Ruvim wrote:
    On 2022-10-04 01:52, Krishna Myneni wrote:
    ..
    No, a dual token system by definition contains execution tokens, one
    for interpretation and one for compilation. There is no suggestion
    that execution tokens should be eliminated.

    I just wanted to say that it's impossible to avoid the notion of default
    compilation semantics without avoiding ordinary words. I also mentioned
    this idea my another message yesterday:
    https://groups.google.com/g/comp.lang.forth/c/dh347IHLDtw/m/_C_XjZ60AwAJ



    You may want to call it default compilation semantics, but on a dual
    token system I would simply think of it as initial compilation semantics >assigned by the system when the word has been defined, i.e. when the
    colon definition specifies the interpretation semantics.

    Regarding those two token system. Chuck Moore experimented with that,
    and has abandoned in favor of a multi color system.
    In more mundane terms every object has multiple methods identified
    by color. Two is not enough.

    I want to go back to recipees. Recipees have no name and can be coupled
    to a name by a dictionary. (Sort of noname definitions.)
    A recipee can (but need not be) be coupled to one name, but subject to manipulation and search order. Recipees can be immediate which affects
    deferred mode, but they behave the same in either mode.
    No smart words, only smart literals like numbers.
    Note that a denotation for a recipee is also a literal, ("quotation").

    --
    Krishna

    Groetjes Albert
    --
    "in our communism country Viet Nam, people are forced to be
    alive and in the western country like US, people are free to
    die from Covid 19 lol" duc ha
    albert@spe&ar&c.xs4all.nl &=n http://home.hccnet.nl/a.w.m.van.der.horst

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From minforth@arcor.de@21:1/5 to none albert on Wed Oct 5 04:39:13 2022
    none albert schrieb am Mittwoch, 5. Oktober 2022 um 11:04:51 UTC+2:
    In article <thj4hv$2tjb2$4...@dont-email.me>,
    Krishna Myneni <krishna...@ccreweb.org> wrote:
    On 10/4/22 16:36, Ruvim wrote:
    On 2022-10-04 01:52, Krishna Myneni wrote:
    ..
    No, a dual token system by definition contains execution tokens, one
    for interpretation and one for compilation. There is no suggestion
    that execution tokens should be eliminated.

    I just wanted to say that it's impossible to avoid the notion of default >> compilation semantics without avoiding ordinary words. I also mentioned
    this idea my another message yesterday:
    https://groups.google.com/g/comp.lang.forth/c/dh347IHLDtw/m/_C_XjZ60AwAJ >>


    You may want to call it default compilation semantics, but on a dual
    token system I would simply think of it as initial compilation semantics >assigned by the system when the word has been defined, i.e. when the
    colon definition specifies the interpretation semantics.
    Regarding those two token system. Chuck Moore experimented with that,
    and has abandoned in favor of a multi color system.
    In more mundane terms every object has multiple methods identified
    by color. Two is not enough.

    I want to go back to recipees. Recipees have no name and can be coupled
    to a name by a dictionary. (Sort of noname definitions.)
    A recipee can (but need not be) be coupled to one name, but subject to manipulation and search order. Recipees can be immediate which affects deferred mode, but they behave the same in either mode.
    No smart words, only smart literals like numbers.
    Note that a denotation for a recipee is also a literal, ("quotation").

    Good points!
    But Chuck's multi-color system didn't go far either ... so ...

    The question remains where you get the payoff for increasing complexity in
    the compiler (by adding "multiple methods") only to cover some obscure
    corner cases that nobody uses in reality (I don't count introspection into one's own Forth system here)

    Simplicity is a virtue by itself!

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Ruvim@21:1/5 to Krishna Myneni on Thu Oct 6 20:40:29 2022
    On 2022-10-05 09:26, Krishna Myneni wrote:
    On 10/4/22 16:36, Ruvim wrote:
    On 2022-10-04 01:52, Krishna Myneni wrote:

    [...]
    Probably you actually thought about something like "compile-nt"

       : compile-nt ( i*x nt -- j*x ) name>compile execute ;

    I actually have such a word in kForth (which is not presently a
    dual-token system) called "COMPILE-NAME", which performs the
    equivalent of NAME>COMPILE EXECUTE . One can still use expressions
    such as "['] FOO COMPILE," or " ... [ ' FOO ] LITERAL COMPILE,".

    On a dual-token system, COMPILE-NAME (or whatever name one wants to
    give it) would be guaranteed to compile the xt referencing the extra
    token referencing the compilation semantics of a word.

    Should it compile the xt, or perform the compilation semantics for the
    word?  Sometimes these actions are different.


    The compilation semantics of the word corresponding to nt is performed
    when COMPILE-NAME executes.


    Does it perform compilation semantics regardless of the STATE?

    For example:

    : translate-123 s" 123" evaluate ; immediate

    : test-123
    [ "translate-123" find-name compile-name ]
    ;
    0 test-123 . . \ should print "0 123"


    If no, your system forces me to specify my intention twice — via "compile-name", and via "state". It's not acceptable for a good API, I
    think.




    NAME>COMPILE should always return the compilation xt, which can be
    independently set on a dual token system, or on a single token system
    which supports "non-default compilation semantics".

    In contrast, ticking a word on a standard system will return an
    execution token corresponding to its interpretation semantics.

    What does "corresponding" mean? How is this execution token connected
    with the execution semantics of the word? How can the interpretation
    semantics be performed? (again, should interpretation state be set or not).



    It sounds incorrectly. By this wording you revoke access to the
    identifier of the execution semantics for a word.


    Not really. In a dual-token system there are explicitly two types of execution semantics: "interpretation semantics" or "compilation
    semantics." It is easier to understand which one we are talking about.
    In contrast, for a traditional system, we have to determine whether the single xt representing execution semantics for a word corresponds to compilation semantics or to interpretation semantics by checking the precedence flag for the word.


    The standard allows the single-xt approach in implementations as well as dual-xt or dual-nt approach. And it specifies an abstract model over all possible implementation variants. And it specifies (should specify) only
    APIs that don't depend on a particular implementation or approach. And a standard program is not bothered whether it runs on a single-xt system,
    or on a dual-xt system.

    The standard specifies the execution semantics term, and the Tick method
    (among other) to obtain an execution token for a word that identifies
    the execution semantics of the word. To perform the interpretation
    semantics for the word, "execute" should be applied to this token in interpretation state. It's true for any standard system, regardless
    whether it's a single-xt system or dual-xt system.



    Sure, we can classify execution semantics by some types, according to
    their internal properties. For example, execution semantics can be
    either STATE-dependent or STATE-independent.

    But "interpretation semantics" and "compilation semantics" are not types
    of execution semantics. These terms are already occupied and defined in
    the standard. Don't clutter them with other meanings. Choose other names.




    [...]
    Your points above about execution token not always representing the interpretation semantics are valid for a traditional Forth system, but
    when you tick a word name, how do you know which semantics are being returned?

    Actually, I may tick only ordinary or immediate word.
    Anyway, when I Tick a word, it returns an identifier of the execution
    semantics for the word.


    In contrast, with the sequence "nt NAME>INTERPRET" or "nt
    NAME>COMPILE", you know precisely to which semantics the result
    corresponds.


    It's questionable, but my questions are above.

    [...]



    --
    Ruvim

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Krishna Myneni@21:1/5 to Ruvim on Thu Oct 6 22:01:12 2022
    On 10/6/22 15:40, Ruvim wrote:
    On 2022-10-05 09:26, Krishna Myneni wrote:


       : compile-nt ( i*x nt -- j*x ) name>compile execute ;

    I actually have such a word in kForth (which is not presently a
    dual-token system) called "COMPILE-NAME", which performs the
    equivalent of NAME>COMPILE EXECUTE . One can still use expressions
    such as "['] FOO COMPILE," or " ... [ ' FOO ] LITERAL COMPILE,".


    Does it perform compilation semantics regardless of the STATE?


    As I have stated above, COMPILE-NAME may be represented exactly in
    standard code as your COMPILE-NT.


    NAME>COMPILE should always return the compilation xt, which can be
    independently set on a dual token system, or on a single token
    system which supports "non-default compilation semantics".
    In contrast, ticking a word on a standard system will return an
    execution token corresponding to its interpretation semantics.

    What does "corresponding" mean?  How is this execution token connected
    with the execution semantics of the word? How can the interpretation semantics be performed? (again, should interpretation state be set or not).


    I was a bit sloppy in my description above. In a single-xt system like
    kForth, NAME>COMPILE returns the compilation semantics as follows:

    For nt corresponding to an IMMEDIATE word, the returned compilation
    semantics are given by two xt's:

    ( nt-word -- xt-word xt-execute )

    When EXECUTE is applied to the stack diagram above, xt-word is
    immediately executed.

    For nt corresponding to a non-immediate word, the returned compilation semantics are given by an nt and an xt:

    ( nt-word -- nt xt-compile-name )

    When EXECUTE is applied to the above stack diagram, the system compiles
    the execution semantics for xt-word. Thus far no use has been made of STATE.


    In contrast, in dual-xt systems, there is no need for the term
    "execution semantics". We can more precisely talk about either
    interpretation semantics (xt-interp) or compilation semantics (xt-comp).
    Which semantics is relevant to the text interpreter -inter- when it
    encounters the word, if STATE is zero, it will obtain the interpretation semantics (xt-interp), else it will obtain the compilation semantics
    (xt-comp). In a dual-xt system The text interpreter does not need to
    examine a precedence flag for the word.

    For both types of systems, single-xt with precedence and dual-xt, we can
    write a simple one line text interpreter as follows.

    : interp ( -- )
    begin
    parse-name find-name
    ?dup if state @ if name>compile else name>interpret then
    then execute then
    again ;

    This interpreter won't recognize numbers, but can be demonstrated like this:

    interp : test true abs dup + false do i . loop ; cr test cr abort

    It should define a word and execute it, printing "0 1". Note that we are
    using only standard words in the definition of the one-line interpreter.



    It sounds incorrectly. By this wording you revoke access to the
    identifier of the execution semantics for a word.


    Not really. In a dual-token system there are explicitly two types of
    execution semantics: "interpretation semantics" or "compilation
    semantics." It is easier to understand which one we are talking about.
    In contrast, for a traditional system, we have to determine whether
    the single xt representing execution semantics for a word corresponds
    to compilation semantics or to interpretation semantics by checking
    the precedence flag for the word.


    The standard allows the single-xt approach in implementations as well as dual-xt or dual-nt approach. And it specifies an abstract model over all possible implementation variants. And it specifies (should specify) only
    APIs that don't depend on a particular implementation or approach. And a standard program is not bothered whether it runs on a single-xt system,
    or on a dual-xt system.

    The standard specifies the execution semantics term, and the Tick method (among other) to obtain an execution token for a word that identifies
    the execution semantics of the word. To perform the interpretation
    semantics for the word, "execute" should be applied to this token in interpretation state. It's true for any standard system, regardless
    whether it's a single-xt system or dual-xt system.



    Sure, we can classify execution semantics by some types, according to
    their internal properties. For example, execution semantics can be
    either STATE-dependent or STATE-independent.

    But "interpretation semantics" and "compilation semantics" are not types
    of execution semantics. These terms are already occupied and defined in
    the standard.  Don't clutter them with other meanings. Choose other names.


    Yes, both "interpretation semantics" and "compilation semantics" are
    types of execution semantics, which should be obvious by the fact that
    they can be represented by tokens on the stack which, when EXECUTEd will perform the behavior required in the appropriate STATE, as illustrated
    by the one-line text interpreter.




    [...]
    Your points above about execution token not always representing the
    interpretation semantics are valid for a traditional Forth system, but
    when you tick a word name, how do you know which semantics are being
    returned?

    Actually, I may tick only ordinary or immediate word.
    Anyway, when I Tick a word, it returns an identifier of the execution semantics for the word.


    In a dual-xt system, which xt do you expect tick or ['] to return?
    xt-interp or xt-comp? It should return xt-interp for backward
    compatibility with single-xt systems.


    In contrast, with the sequence "nt NAME>INTERPRET" or "nt
    NAME>COMPILE", you know precisely to which semantics the result
    corresponds.


    It's questionable, but my questions are above.


    Maybe my example helps to clarify.

    --
    Krishna

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Krishna Myneni@21:1/5 to Krishna Myneni on Thu Oct 6 22:05:26 2022
    On 10/6/22 22:01, Krishna Myneni wrote:
    ..
    I was a bit sloppy in my description above. In a single-xt system like kForth, NAME>COMPILE returns the compilation semantics as follows:

    For nt corresponding to an IMMEDIATE word, the returned compilation
    semantics are given by two xt's:

    ( nt-word -- xt-word xt-execute )

    When EXECUTE is applied to the stack diagram above, xt-word is
    immediately executed.

    For nt corresponding to a non-immediate word, the returned compilation semantics are given by an nt and an xt:

    ( nt-word -- nt xt-compile-name )

    ..

    The stack diagram above should be

    ( nt-word -- nt-word xt-compile-name )

    --
    KM

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Ruvim@21:1/5 to Krishna Myneni on Fri Oct 7 09:38:44 2022
    On 2022-10-07 03:01, Krishna Myneni wrote:
    On 10/6/22 15:40, Ruvim wrote:
    On 2022-10-05 09:26, Krishna Myneni wrote:


       : compile-nt ( i*x nt -- j*x ) name>compile execute ;

    I actually have such a word in kForth (which is not presently a
    dual-token system) called "COMPILE-NAME", which performs the
    equivalent of NAME>COMPILE EXECUTE . One can still use expressions
    such as "['] FOO COMPILE," or " ... [ ' FOO ] LITERAL COMPILE,".


    Does it perform compilation semantics regardless of the STATE?


    As I have stated above, COMPILE-NAME may be represented exactly in
    standard code as your COMPILE-NT.

    It does not answer to my question, since your "name>compile" can return
    xt that always identifies STATE-independent execution semantics.

    Therefore, I provided a test to check how it works:

    : translate-123 s" 123" evaluate ; immediate

    : test-123
    [ "translate-123" find-name compile-name ]
    ;
    0 test-123 . . \ should print "0 123"


    I guess, this test fails in your system.


    So, if a user wants to perform th compilation semantics for a word, what
    is your reasoning to force the user to specify his intention *twice* in
    the same time — via "compile-name" and via entering into compilation
    state before call "compile-name"?



    NAME>COMPILE should always return the compilation xt, which can be
    independently set on a dual token system, or on a single token
    system which supports "non-default compilation semantics".
    In contrast, ticking a word on a standard system will return an
    execution token corresponding to its interpretation semantics.

    What does "corresponding" mean?  How is this execution token connected
    with the execution semantics of the word? How can the interpretation
    semantics be performed? (again, should interpretation state be set or
    not).


    I was a bit sloppy in my description above. In a single-xt system like kForth, NAME>COMPILE returns the compilation semantics as follows:

    For nt corresponding to an IMMEDIATE word, the returned compilation
    semantics are given by two xt's:

    ( nt-word -- xt-word xt-execute )

    When EXECUTE is applied to the stack diagram above, xt-word is
    immediately executed.

    Then, to perform the compilation semantics for an immediate word, the
    user should use "name>compile" and enter into compilation state — again,
    he should specify his intention twice.

    Also, the user should know whether the word is immediate or not.

    But, having the nt of a word, there is no a standard way to detect
    whether the corresponding word is immediate or not.


    Actually, an API should not require user to know whether a word is
    immediate or not. See A.6.1.2033 — why POSTPONE was introduced.



    For nt corresponding to a non-immediate word, the returned compilation semantics are given by an nt and an xt:

    ( nt-word -- nt xt-compile-name )

    When EXECUTE is applied to the above stack diagram, the system compiles
    the execution semantics for xt-word. Thus far no use has been made of
    STATE.


    The compilation semantics for an ordinary word are to *append* its
    execution semantics to the current definition.

    The compilation semantics for an immediate word are to *performs* its
    execution semantics in compilation state.

    In the general case, there can be standard words, which the system
    provides, that are neither immediate nor ordinary.

    For example, the word S" in a standard system can be implemented in such
    a way that if you tick this word, and executes the returned xt in
    compilation state — it will not perform the compilation semantics for
    this word. Hence, this word is nonimmediate in such a case.


    [...]


    --
    Ruvim

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Ruvim@21:1/5 to Ruvim on Fri Oct 7 09:44:52 2022
    On 2022-10-07 09:38, Ruvim wrote:
    On 2022-10-07 03:01, Krishna Myneni wrote:
    On 10/6/22 15:40, Ruvim wrote:
    On 2022-10-05 09:26, Krishna Myneni wrote:


       : compile-nt ( i*x nt -- j*x ) name>compile execute ;

    I actually have such a word in kForth (which is not presently a
    dual-token system) called "COMPILE-NAME", which performs the
    equivalent of NAME>COMPILE EXECUTE . One can still use expressions >>>>>> such as "['] FOO COMPILE," or " ... [ ' FOO ] LITERAL COMPILE,".


    Does it perform compilation semantics regardless of the STATE?


    As I have stated above, COMPILE-NAME may be represented exactly in
    standard code as your COMPILE-NT.

    It does not answer to my question, since your "name>compile" can return
    xt that always identifies STATE-independent execution semantics.

    Therefore, I provided a test to check how it works:

      : translate-123 s" 123" evaluate ; immediate

      : test-123
        [ "translate-123" find-name compile-name ]
      ;
      0 test-123 . . \ should print "0 123"

    Typo correction:

    0 test-123 . . \ should print "123 0"



    --
    Ruvim

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Krishna Myneni@21:1/5 to Ruvim on Fri Oct 7 13:58:48 2022
    On 10/7/22 04:38, Ruvim wrote:
    On 2022-10-07 03:01, Krishna Myneni wrote:
    On 10/6/22 15:40, Ruvim wrote:
    On 2022-10-05 09:26, Krishna Myneni wrote:


       : compile-nt ( i*x nt -- j*x ) name>compile execute ;

    I actually have such a word in kForth (which is not presently a
    dual-token system) called "COMPILE-NAME", which performs the
    equivalent of NAME>COMPILE EXECUTE . One can still use expressions >>>>>> such as "['] FOO COMPILE," or " ... [ ' FOO ] LITERAL COMPILE,".


    Does it perform compilation semantics regardless of the STATE?


    As I have stated above, COMPILE-NAME may be represented exactly in
    standard code as your COMPILE-NT.

    It does not answer to my question, since your "name>compile" can return
    xt that always identifies STATE-independent execution semantics.

    Therefore, I provided a test to check how it works:

      : translate-123 s" 123" evaluate ; immediate

      : test-123
        [ "translate-123" find-name compile-name ]
      ;
      0 test-123 . . \ should print "0 123"


    I guess, this test fails in your system.


    Yes, it does fail:

    ----
    : translate-123 s" 123" evaluate ; immediate
    ok
    : test-123 [ s" translate-123" find-name compile-name ] ;
    ok
    0 test-123 .
    0 ok

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Krishna Myneni@21:1/5 to Krishna Myneni on Fri Oct 7 15:08:18 2022
    On 10/7/22 13:58, Krishna Myneni wrote:
    On 10/7/22 04:38, Ruvim wrote:
    On 2022-10-07 03:01, Krishna Myneni wrote:
    On 10/6/22 15:40, Ruvim wrote:
    On 2022-10-05 09:26, Krishna Myneni wrote:


       : compile-nt ( i*x nt -- j*x ) name>compile execute ;

    I actually have such a word in kForth (which is not presently a
    dual-token system) called "COMPILE-NAME", which performs the
    equivalent of NAME>COMPILE EXECUTE . One can still use
    expressions such as "['] FOO COMPILE," or " ... [ ' FOO ] LITERAL >>>>>>> COMPILE,".


    Does it perform compilation semantics regardless of the STATE?


    As I have stated above, COMPILE-NAME may be represented exactly in
    standard code as your COMPILE-NT.

    It does not answer to my question, since your "name>compile" can
    return xt that always identifies STATE-independent execution semantics.

    Therefore, I provided a test to check how it works:

       : translate-123 s" 123" evaluate ; immediate

       : test-123
         [ "translate-123" find-name compile-name ]
       ;
       0 test-123 . . \ should print "0 123"


    I guess, this test fails in your system.


    Yes, it does fail:

    ----
    : translate-123 s" 123" evaluate ; immediate
     ok
    : test-123 [ s" translate-123" find-name compile-name ] ;
     ok
    0 test-123 .
    0  ok

    Hmm... my newsreader is acting funny. My reply to you got truncated. The intended reply goes on to say that this is an implementation deficiency
    in COMPILE-NAME and it can be fixed. COMPILE-NAME like "COMPILE," should
    be able to execute the compilation semantics of the word referenced by
    nt from interpretation state when there is an unclosed definition.

    --
    Krishna

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From P Falth@21:1/5 to Krishna Myneni on Fri Oct 7 13:55:38 2022
    On Friday, 7 October 2022 at 20:58:51 UTC+2, Krishna Myneni wrote:
    On 10/7/22 04:38, Ruvim wrote:
    On 2022-10-07 03:01, Krishna Myneni wrote:
    On 10/6/22 15:40, Ruvim wrote:
    On 2022-10-05 09:26, Krishna Myneni wrote:


    : compile-nt ( i*x nt -- j*x ) name>compile execute ;

    I actually have such a word in kForth (which is not presently a >>>>>> dual-token system) called "COMPILE-NAME", which performs the
    equivalent of NAME>COMPILE EXECUTE . One can still use expressions >>>>>> such as "['] FOO COMPILE," or " ... [ ' FOO ] LITERAL COMPILE,". >>>>>>

    Does it perform compilation semantics regardless of the STATE?


    As I have stated above, COMPILE-NAME may be represented exactly in
    standard code as your COMPILE-NT.

    It does not answer to my question, since your "name>compile" can return
    xt that always identifies STATE-independent execution semantics.

    Therefore, I provided a test to check how it works:

    : translate-123 s" 123" evaluate ; immediate

    : test-123
    [ "translate-123" find-name compile-name ]
    ;
    0 test-123 . . \ should print "0 123"


    I guess, this test fails in your system.

    Yes, it does fail:

    ----
    : translate-123 s" 123" evaluate ; immediate
    ok
    : test-123 [ s" translate-123" find-name compile-name ] ;
    ok
    0 test-123 .
    0 ok

    Also my two systems ntf/lxf a dual xt system and ntf64/lxf64 a single xt system
    fails this test.
    I think that is correct as the test in my opinion is flawed!
    translate-123 will correctly get executed by compile-name.
    As the system is in interpretative state when this happens
    123 just gets placed on the stack. This is the correct behavior.

    To pass Ruvim's test you can define compile-name as

    : compile-name name>compile ] execute postpone [ ;

    Better would be to define : [execute] execute ; immediate
    and write the test as
    : test-123b [ s" translate-123" find-name name>compile ] [execute] ;

    But the standard way would be

    : test-123c translate-123 ;

    Writing this in a single xt system like

    : test-123d [ ' translate-123 compile, ] ;
    It looks to pass the test, but has instead just postponed the translate-123. As translate-123 is immediate it should be written
    : test-123d [ ' translate-123 execute ] ;
    and it will fail again

    Krishna, I introduced the two XT header over 20 years ago. It works like you have described. No set-optimizer and a compile, that just compiles a call to the xt.
    The syntax is different:

    :p name ...... ;p defines the compilation semantics
    :r name ....... ;r defines the interpretative semantics

    As the name is repeated they do not need to be defined at the same time.
    In fact the compilation semantics are defined in the meta compilation and
    the interpretative part when the new system is extended.

    Best Regards
    Peter Fälth

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Krishna Myneni@21:1/5 to P Falth on Fri Oct 7 17:55:01 2022
    On 10/7/22 15:55, P Falth wrote:
    On Friday, 7 October 2022 at 20:58:51 UTC+2, Krishna Myneni wrote:
    On 10/7/22 04:38, Ruvim wrote:
    On 2022-10-07 03:01, Krishna Myneni wrote:
    On 10/6/22 15:40, Ruvim wrote:
    On 2022-10-05 09:26, Krishna Myneni wrote:


    : compile-nt ( i*x nt -- j*x ) name>compile execute ;

    I actually have such a word in kForth (which is not presently a >>>>>>>> dual-token system) called "COMPILE-NAME", which performs the
    equivalent of NAME>COMPILE EXECUTE . One can still use expressions >>>>>>>> such as "['] FOO COMPILE," or " ... [ ' FOO ] LITERAL COMPILE,". >>>>>>>>

    Does it perform compilation semantics regardless of the STATE?


    As I have stated above, COMPILE-NAME may be represented exactly in
    standard code as your COMPILE-NT.

    It does not answer to my question, since your "name>compile" can return
    xt that always identifies STATE-independent execution semantics.

    Therefore, I provided a test to check how it works:

    : translate-123 s" 123" evaluate ; immediate

    : test-123
    [ "translate-123" find-name compile-name ]
    ;
    0 test-123 . . \ should print "0 123"


    I guess, this test fails in your system.

    Yes, it does fail:

    ----
    : translate-123 s" 123" evaluate ; immediate
    ok
    : test-123 [ s" translate-123" find-name compile-name ] ;
    ok
    0 test-123 .
    0 ok

    Also my two systems ntf/lxf a dual xt system and ntf64/lxf64 a single xt system
    fails this test.
    I think that is correct as the test in my opinion is flawed!
    translate-123 will correctly get executed by compile-name.
    As the system is in interpretative state when this happens
    123 just gets placed on the stack. This is the correct behavior.


    That would certainly be the correct behavior when there is no open
    definition. In kForth COMPILE-NAME is a primitive and can use
    system-specific knowledge to determine whether or not a definition is in progress and compile into the current definition when that is the case,
    as with "COMPILE,". It simply means that COMPILE-NAME cannot be defined
    in standard Forth.

    To pass Ruvim's test you can define compile-name as

    : compile-name name>compile ] execute postpone [ ;

    ..

    Krishna, I introduced the two XT header over 20 years ago. It works like you have described. No set-optimizer and a compile, that just compiles a call to the xt.
    The syntax is different:

    :p name ...... ;p defines the compilation semantics
    :r name ....... ;r defines the interpretative semantics


    Returning to the original post, FVALUE and 2VALUE can be implemented
    without STATE. But in my system there is a significant penalty for doing
    so. The elegance, simplicity, and flexibility of a dual-xt system -- yes simplicity -- truly appeals to me. Your experience, and that of others,
    with implementing such a system gives me additional motivation to make
    an experimental branch of kForth-64 which provides for dual semantics.

    I understand that commercial vendors of Forth systems have to take a
    more conservative approach to the evolution of their systems. This is
    where open-source/free Forths can contribute to exploring evolutionary
    paths for future Forth standards.

    --
    Krishna

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From none) (albert@21:1/5 to ruvim.pinka@gmail.com on Sat Oct 8 09:42:29 2022
    In article <thos39$3ji4p$1@dont-email.me>,
    Ruvim <ruvim.pinka@gmail.com> wrote:
    <SNIP>

    In the general case, there can be standard words, which the system
    provides, that are neither immediate nor ordinary.

    For example, the word S" in a standard system can be implemented in such
    a way that if you tick this word, and executes the returned xt in
    compilation state — it will not perform the compilation semantics for
    this word. Hence, this word is nonimmediate in such a case.

    That makes the case that S" should be forbidden. It is not needed in
    view of recognizers/prefixes.


    --
    Ruvim

    Groetjes Albert

    --
    "in our communism country Viet Nam, people are forced to be
    alive and in the western country like US, people are free to
    die from Covid 19 lol" duc ha
    albert@spe&ar&c.xs4all.nl &=n http://home.hccnet.nl/a.w.m.van.der.horst

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Ruvim@21:1/5 to Krishna Myneni on Sat Oct 8 09:38:26 2022
    On 2022-10-07 03:01, Krishna Myneni wrote:
    On 10/6/22 15:40, Ruvim wrote:
    On 2022-10-05 09:26, Krishna Myneni wrote:


    [...]


    It sounds incorrectly. By this wording you revoke access to the
    identifier of the execution semantics for a word.


    Not really. In a dual-token system there are explicitly two types of
    execution semantics: "interpretation semantics" or "compilation
    semantics." It is easier to understand which one we are talking
    about. In contrast, for a traditional system, we have to determine
    whether the single xt representing execution semantics for a word
    corresponds to compilation semantics or to interpretation semantics
    by checking the precedence flag for the word.


    The standard allows the single-xt approach in implementations as well
    as dual-xt or dual-nt approach. And it specifies an abstract model
    over all possible implementation variants. And it specifies (should
    specify) only APIs that don't depend on a particular implementation or
    approach. And a standard program is not bothered whether it runs on a
    single-xt system, or on a dual-xt system.

    The standard specifies the execution semantics term, and the Tick
    method (among other) to obtain an execution token for a word that
    identifies the execution semantics of the word. To perform the
    interpretation semantics for the word, "execute" should be applied to
    this token in interpretation state. It's true for any standard system,
    regardless whether it's a single-xt system or dual-xt system.



    Sure, we can classify execution semantics by some types, according to
    their internal properties. For example, execution semantics can be
    either STATE-dependent or STATE-independent.

    But "interpretation semantics" and "compilation semantics" are not
    types of execution semantics. These terms are already occupied and
    defined in the standard.  Don't clutter them with other meanings.
    Choose other names.


    Yes, both "interpretation semantics" and "compilation semantics" are
    types of execution semantics, which should be obvious by the fact that
    they can be represented by tokens on the stack which, when EXECUTEd will perform the behavior required in the appropriate STATE, as illustrated
    by the one-line text interpreter.




    Well, then please provide definitions of these types, and criteria — how
    to detect whether an xt identifies execution semantics of one or another
    type.



    [...]


    --
    Ruvim

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Ruvim@21:1/5 to Krishna Myneni on Sat Oct 8 09:55:05 2022
    On 2022-10-07 03:01, Krishna Myneni wrote:
    On 10/6/22 15:40, Ruvim wrote:
    On 2022-10-05 09:26, Krishna Myneni wrote:


    [...]

    In contrast, in dual-xt systems, there is no need for the term
    "execution semantics".

    Even if some standard dual-xt system doesn't need the term "execution semantics" under the hood, it shall map the standard notions of
    "execution semantics" and "identifier of execution semantics" to its
    internal notions.

    Have a look:

    :noname 123 . ; ( xt )


    For a standard program it does not matter what this xt means in your
    system under the hood, and how you call it internally.

    For a standard program this xt is an identifier of execution semantics,
    namely of the execution semantics that are defined in the body of this
    unnamed definition.




    [...]
    Your points above about execution token not always representing the
    interpretation semantics are valid for a traditional Forth system,
    but when you tick a word name, how do you know which semantics are
    being returned?

    Actually, I may tick only ordinary or immediate word.
    Anyway, when I Tick a word, it returns an identifier of the execution
    semantics for the word.


    In a dual-xt system, which xt do you expect tick or ['] to return?
    xt-interp or xt-comp? It should return xt-interp for backward
    compatibility with single-xt systems.

    The standard does not specify a notion of xt-interp or xt-comp.

    On any standard system Tick shall return an xt that identifies the
    execution semantics of a word.

    When a user defines a word via Colon, he defines the execution semantics
    for this word.

    For example, see 6.1.0450 : (colon)

    | The execution semantics of /name/ will be determined
    | by the words compiled into the body of the definition.


    For the most standard words the execution semantics are specified.

    When execution semantics are not specified for a standard word, the
    system may provide implementation-dependent execution semantics for the
    word. But it's ambiguous to perform these execution semantics in the
    general case, and it's ambiguous even to apply Tick to such a standard word.


    In a dual-xt system I would make the first xt identify the execution
    semantics for the word. The second xt — identifies the execution
    semantics of a definition that is used to perform the special
    compilation semantics for a word (if any).


    I would not provide the "name>interpret" and "name>compile" words since
    they are flawed by design and insufficiently specified to be usable on
    any standard system.


    I would provide "find", "find-name", and words as:

    find-semantics ( sd.name -- xt1 xt2 ) \ stateless
    compile-name ( i*x nt -- j*x )
    interpret-name ( i*x nt -- j*x )


    Well, having internal words like

    name>xt ( nt -- xt true | nt false )
    name>xt2 ( nt -- xt true | nt false )


    The words of an public API can be defined as follows:

    : compilation ( -- flag ) state @ 0<> ;
    : leave-compilation ( -- ) ] ;
    : enter-compilation ( -- ) postpone [ ;


    : execute-interpretively ( i*x xt -- j*x )
    compilation 0= if execute exit then
    leave-compilation execute enter-compilation
    ;
    : execute-compilatively ( i*x xt -- j*x )
    compilation if execute exit then
    enter-compilation execute leave-compilation
    ;
    : interpret-name ( i*x nt -- j*x )
    name>xt 0= -14 and throw execute-interpretively
    ;
    : compile-name ( i*x nt -- j*x )
    name>xt2 if execute-compilatively exit then
    name>xt 0= -14 and throw compile,
    ;


    : postpone-name ( nt -- )
    \ portable implementation
    lit, ['] compile-name compile,
    ;
    : postpone-name ( nt -- )
    \ system-specific implementation, which is slightly more efficient
    name>xt2 if lit, ['] execute-compilatively compile, exit then
    name>xt 0= -32 and throw lit, ['] compile, compile,
    ;
    : postpone ( "name" -- )
    parse-name find-name dup 0= -32 and throw postpone-name
    ; immediate



    : find-semantics ( sd.name -- xt.word|0 xt.special-com|0 )
    \ stateless
    find-name dup 0= if 0 exit then
    dup name>xt and swap name>xt2 and
    ;

    : find-word? ( sd.name -- xt flag.special true | false )
    \ stateful
    find-semantics compilation if
    dup if nip true true exit then drop
    dup if false true exit then ( false )
    exit
    then
    over 0= if 2drop false exit then 0<> true
    ;
    : find-word ( sd.name -- xt flag.special true | sd.name false )
    \ stateful
    2dup 2>r find-word? dup if 2rdrop exit then drop 2r> false
    ;
    : find ( c-addr -- c-addr 0 | xt 1 | xt -1 )
    \ stateful
    dup >r count find-word? 0= if r> 0 exit then rdrop
    if 1 else -1 then
    ;


    : immediate ( -- )
    latest-name name>xt -32 ?throw name-xt2!
    ;

    : compile: ( "name" -- ) ( C: -- colon-sys )
    parse-name find-name dup -13 ?throw >r
    ['] :noname execute-balance 1- pick r> name-xt2!
    ;


    Where

    \ latest-name ( -- nt )
    \ Return the name token nt for the definition
    \ whose name was placed into the compilation word list most recently,
    \ or throw an exception if there is no such a definition.


    : execute-balance ( i*x xt -- j*x n )
    \ Take xt, execute it and place on the stack
    \ the stack depth difference
    depth 1- >r execute depth r> -
    ;



    --
    Ruvim

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Ruvim@21:1/5 to P Falth on Sat Oct 8 10:25:16 2022
    On 2022-10-07 20:55, P Falth wrote:
    On Friday, 7 October 2022 at 20:58:51 UTC+2, Krishna Myneni wrote:
    On 10/7/22 04:38, Ruvim wrote:
    On 2022-10-07 03:01, Krishna Myneni wrote:
    On 10/6/22 15:40, Ruvim wrote:
    On 2022-10-05 09:26, Krishna Myneni wrote:


    : compile-nt ( i*x nt -- j*x ) name>compile execute ;

    I actually have such a word in kForth (which is not presently a >>>>>>>> dual-token system) called "COMPILE-NAME", which performs the
    equivalent of NAME>COMPILE EXECUTE . One can still use expressions >>>>>>>> such as "['] FOO COMPILE," or " ... [ ' FOO ] LITERAL COMPILE,". >>>>>>>>

    Does it perform compilation semantics regardless of the STATE?


    As I have stated above, COMPILE-NAME may be represented exactly in
    standard code as your COMPILE-NT.

    It does not answer to my question, since your "name>compile" can return
    xt that always identifies STATE-independent execution semantics.

    Therefore, I provided a test to check how it works:

    : translate-123 s" 123" evaluate ; immediate

    : test-123
    [ "translate-123" find-name compile-name ]
    ;
    0 test-123 . . \ should print "0 123"


    I guess, this test fails in your system.

    Yes, it does fail:

    ----
    : translate-123 s" 123" evaluate ; immediate
    ok
    : test-123 [ s" translate-123" find-name compile-name ] ;
    ok
    0 test-123 .
    0 ok

    Also my two systems ntf/lxf a dual xt system and ntf64/lxf64 a single xt system
    fails this test.
    I think that is correct as the test in my opinion is flawed!

    What make you think so?


    translate-123 will correctly get executed by compile-name.
    As the system is in interpretative state when this happens
    123 just gets placed on the stack. This is the correct behavior.

    When I apply "compile-name" to an nt, my intention (and expectation) is
    to perform the behavior that takes place when the Forth text interpreter encounters the corresponding word name in compilation state. (¹)

    Otherwise, if I want to perform this behavior, you forced me to specify
    my intention *twice* — via enter into compilation state and via use of "compile-name". It would be a flawed API.

    And, there are no cases when you need to perform via "compile-name" a
    behavior that will not be equivalent to the behavior (¹).
    Counterexamples are welcome.




    To pass Ruvim's test you can define compile-name as

    : compile-name name>compile ] execute postpone [ ;

    Yes, but a little more sophisticated.

    You should not leave compilation state if the system was in compilation
    state before executing the xt.



    --
    Ruvim

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Krishna Myneni@21:1/5 to Ruvim on Sat Oct 8 14:33:15 2022
    On 10/8/22 04:55, Ruvim wrote:
    On 2022-10-07 03:01, Krishna Myneni wrote:
    On 10/6/22 15:40, Ruvim wrote:
    On 2022-10-05 09:26, Krishna Myneni wrote:


    [...]


    In a dual-xt system, which xt do you expect tick or ['] to return?
    xt-interp or xt-comp? It should return xt-interp for backward
    compatibility with single-xt systems.

    The standard does not specify a notion of xt-interp or xt-comp.


    The statement above is absurd. The standard defines both "compilation semantics" and "interpretation semantics". Even if it didn't, these
    terms would be broadly understood. Are you claiming that the standard
    does not permit the creation of execution tokens which, when executed
    (using EXECUTE), perform the behavior of the two distinct semantics?

    ...
    I would not provide the "name>interpret" and "name>compile" words since
    they are flawed by design and insufficiently specified to be usable on
    any standard system.

    ..

    Both NAME>INTERPRET and NAME>COMPILE are standard words in Forth-2012.
    They may be implemented in either single-xt + immediate flag systems or
    in dual-xt systems, as demonstrated by various existing Forth-2012
    compliant systems. I don't understand your basis for deeming them to be insufficiently specified to be usable on a standard system. But it seems
    to me that it may be due to your overly narrow interpretation of the
    term "execution semantics". In any case, you can always propose
    alternate language to the specs for NAME>INTERPRET and NAME>COMPILE to
    remedy your perceived deficiencies.


    --
    Krishna

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Anton Ertl@21:1/5 to Ruvim on Sun Oct 9 07:32:49 2022
    Ruvim <ruvim.pinka@gmail.com> writes:
    Actually, ticking a word on a standard system returns the execution
    token that identifies the execution semantics for *this* word.

    Not in the case of words with undefined interpretation semantics,
    thanks to

    |4.1.2 Ambiguous conditions
    ...
    |attempting to obtain the execution token, (e.g., with 6.1.0070 ',
    |6.1.1550 FIND, etc. of a definition with undefined interpretation
    |semantics;

    And given

    |6.1.0070 '
    ...
    |When interpreting, ' xyz EXECUTE is equivalent to xyz.

    one can argue that ' should return the xt representing the
    interpretation semantics of the word. My position is that this is the
    most useful interpretation. There are some words where we want to
    allow STATE-smartness as a concession to existing system
    implementation practice, and Forth-2012 has partially addressed this
    by disallowing ticking of some of these words (e.g., S"); for some we
    did not yet, but we should.

    Since, to perform the compilation semantics for an immediate word, its >execution token shall be executed in compilation state

    No.

    to perform the
    interpretation semantics — it shall be executed in interpretation state.

    No.

    When you refer this execution token as one corresponding to the >interpretation semantics of a word, you also make an impression that >executing this token performs the interpretation semantics for the word >regardless of STATE.

    Yes.

    - anton
    --
    M. Anton Ertl http://www.complang.tuwien.ac.at/anton/home.html
    comp.lang.forth FAQs: http://www.complang.tuwien.ac.at/forth/faq/toc.html
    New standard: https://forth-standard.org/
    EuroForth 2022: https://euro.theforth.net

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Anton Ertl@21:1/5 to Krishna Myneni on Sun Oct 9 07:51:38 2022
    Krishna Myneni <krishna.myneni@ccreweb.org> writes:
    On 10/4/22 16:36, Ruvim wrote:
    [...]
    In a dual-token system there are explicitly two types of
    execution semantics: "interpretation semantics" or "compilation
    semantics."

    I would say: There is interpretation semantics and there is
    compilation semantics. There have been some arguments that execution
    semantics is a third entity, but given that there are no words that
    have defined execution semantics and defined interpretation semantics
    where these two differ, I view execution semantics for a named word as
    a helper concept for defining interpretation and/or compilation
    semantics.

    It is easier to understand which one we are talking about.
    In contrast, for a traditional system, we have to determine whether the >single xt representing execution semantics for a word corresponds to >compilation semantics or to interpretation semantics by checking the >precedence flag for the word.

    Actually, in a traditional single-xt+immediate-flag system, the xt
    always represents the interpretation semantics, and is always part of
    the compilation semantics: if the word is immediate, the compilation
    semantics are to EXECUTE the xt (immediate compilation semantics),
    otherwise they are to COMPILE, the xt (default compilation semantics).
    There is no way to create words with compilation semantics that are
    neither default nor immediate.

    Yes, usually, this execution token is used by the system to *perform*
    the interpretation semantics for the word.

    But, for some words, this the same execution token may be also used to
    perform the compilation semantics for the word. Namely, if the word is
    an immediate word.

    Since, to perform the compilation semantics for an immediate word, its
    execution token shall be executed in compilation state, to perform the
    interpretation semantics — it shall be executed in interpretation state.

    No.

    When you refer this execution token as one corresponding to the
    interpretation semantics of a word, you also make an impression that
    executing this token performs the interpretation semantics for the word
    regardless of STATE.

    This impression is correct.

    A particular example of where this is important is array indexing, e.g.

    A{ I }

    with the indexing word "}" -- one needs "}" to work in both the
    interpreter and from within a definition, but the compilation semantics >usually need to be different from the interpretation semantics to obtain
    the best possible efficiency.

    This sounds like you want to optimize, not change the default
    compilation semantics.

    - anton
    --
    M. Anton Ertl http://www.complang.tuwien.ac.at/anton/home.html
    comp.lang.forth FAQs: http://www.complang.tuwien.ac.at/forth/faq/toc.html
    New standard: https://forth-standard.org/
    EuroForth 2022: https://euro.theforth.net

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Anton Ertl@21:1/5 to minf...@arcor.de on Sun Oct 9 08:08:31 2022
    "minf...@arcor.de" <minforth@arcor.de> writes:
    The question remains where you get the payoff for increasing complexity in >the compiler (by adding "multiple methods") only to cover some obscure
    corner cases that nobody uses in reality

    Evidence for "nobody uses"? The typical usage of "nobody uses"
    actually means "I don't use", or maybe even just "you should not use
    it".

    I find that I have tripped in practice over such a corner case, and
    that, being aware of them, I find such limitations quite burdensome
    for some things I want to do (which of course the people who claim
    "nobody uses" think are things I should not do).

    Simplicity is a virtue by itself!

    If simplicity in one place breeds complexity elsewhere, it's not a
    virtue, but a vice.

    - anton
    --
    M. Anton Ertl http://www.complang.tuwien.ac.at/anton/home.html
    comp.lang.forth FAQs: http://www.complang.tuwien.ac.at/forth/faq/toc.html
    New standard: https://forth-standard.org/
    EuroForth 2022: https://euro.theforth.net

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Krishna Myneni@21:1/5 to Anton Ertl on Sun Oct 9 08:48:31 2022
    On 10/9/22 02:51, Anton Ertl wrote:
    Krishna Myneni <krishna.myneni@ccreweb.org> writes:
    On 10/4/22 16:36, Ruvim wrote:
    [...]
    In a dual-token system there are explicitly two types of
    execution semantics: "interpretation semantics" or "compilation
    semantics."

    I would say: There is interpretation semantics and there is
    compilation semantics. There have been some arguments that execution semantics is a third entity, but given that there are no words that
    have defined execution semantics and defined interpretation semantics
    where these two differ, I view execution semantics for a named word as
    a helper concept for defining interpretation and/or compilation
    semantics.


    Yes, it should be "interpretation semantics" and "compilation
    semantics". Execution semantics, in concrete form, is represented by an
    xt. When the xt is EXECUTEd, the "execution semantics" are performed.
    Likewise, "interpretation semantics" and "compilation semantics" may be represented by xt's. They are simply particular types of execution
    semantics.


    It is easier to understand which one we are talking about.
    In contrast, for a traditional system, we have to determine whether the
    single xt representing execution semantics for a word corresponds to
    compilation semantics or to interpretation semantics by checking the
    precedence flag for the word.

    Actually, in a traditional single-xt+immediate-flag system, the xt
    always represents the interpretation semantics, and is always part of
    the compilation semantics: if the word is immediate, the compilation semantics are to EXECUTE the xt (immediate compilation semantics),
    otherwise they are to COMPILE, the xt (default compilation semantics).
    There is no way to create words with compilation semantics that are
    neither default nor immediate.


    I don't see any distinction between your description and mine, except
    you note that the compilation semantics are further restricted by
    including explicitly the interpretation semantics. Such a restriction is
    not necessary in dual-xt systems, although compilation semantics may be initialized in a dual-xt system to provide the same behavior as the interpretation semantics.

    ..
    A particular example of where this is important is array indexing, e.g.

    A{ I }

    with the indexing word "}" -- one needs "}" to work in both the
    interpreter and from within a definition, but the compilation semantics
    usually need to be different from the interpretation semantics to obtain
    the best possible efficiency.

    This sounds like you want to optimize, not change the default
    compilation semantics.


    It's easy to be careless in misusing terms like "compilation semantics",
    and that's what happened above. For this example, the compilation
    semantics remains the same, but the implementation of the compilation
    semantics is optimized.

    For other cases, the compilation semantics may differ from the
    initialized compilation semantics, e.g. when the new compilation
    semantics includes the older one but provides additional behavior to
    instrument the word's usage.

    --
    Krishna

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Krishna Myneni@21:1/5 to Krishna Myneni on Sun Oct 9 10:13:13 2022
    On 10/9/22 08:48, Krishna Myneni wrote:

    ... although compilation semantics may be
    initialized in a dual-xt system to provide the same behavior as the interpretation semantics.
    ...

    should be

    .. although compilation semantics may be initialized for a definition
    in dual-xt system to append the interpretation semantics to the definition.

    --
    Krishna

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Anton Ertl@21:1/5 to Krishna Myneni on Sun Oct 9 15:20:54 2022
    Krishna Myneni <krishna.myneni@ccreweb.org> writes:
    Yes, both "interpretation semantics" and "compilation semantics" are
    types of execution semantics, which should be obvious by the fact that
    they can be represented by tokens on the stack which, when EXECUTEd will >perform the behavior required in the appropriate STATE, as illustrated
    by the one-line text interpreter.

    I don't think it is particularly useful to think of interpretation
    semantics as a type of execution semantics, just because it is
    represented by an xt. And looking at <https://forth-standard.org/proposals/reword-the-term-execution-token-?hideDiff#reply-742>,
    all voting members in the 2021 Forth200x meeting agreed.

    Yes, you can argue that for :noname definitions we talk only about
    execution semantics (and they are represented by an xt), and therefore
    the xt we get from NAME>INTERPRET for a named word also represents
    some kind of execution semantics, but what would be the point?

    Concerning compilation semantics, they are represented by ( x xt ),
    not just by an xt, so it's much harder to argue that there is some
    (anonymous) word around that has these compilation semantics as
    execution semantics. E.g., the compilation semantics of + might be
    represented by

    ' + ' compile,

    Systems usually don't have a word that has these execution semantics;
    Gforth certainly does not. The reason why compilation semantics are represented by two cells is because many systems don't have compilation-semantics words that would represent them in one cell.

    In a dual-xt system, which xt do you expect tick or ['] to return?

    The xt representing interpretation semantics.

    xt-interp or xt-comp? It should return xt-interp for backward
    compatibility with single-xt systems.

    - anton
    --
    M. Anton Ertl http://www.complang.tuwien.ac.at/anton/home.html
    comp.lang.forth FAQs: http://www.complang.tuwien.ac.at/forth/faq/toc.html
    New standard: https://forth-standard.org/
    EuroForth 2022: https://euro.theforth.net

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Ruvim@21:1/5 to Anton Ertl on Sun Oct 9 16:19:34 2022
    On 2022-10-09 07:32, Anton Ertl wrote:
    Ruvim <ruvim.pinka@gmail.com> writes:
    Actually, ticking a word on a standard system returns the execution
    token that identifies the execution semantics for *this* word.

    Not in the case of words with undefined interpretation semantics,

    Of course, except the cases when ticking is ambiguous — this is implied
    by default.

    thanks to

    |4.1.2 Ambiguous conditions
    ...
    |attempting to obtain the execution token, (e.g., with 6.1.0070 ',
    |6.1.1550 FIND, etc. of a definition with undefined interpretation |semantics;

    And given

    |6.1.0070 '
    ...
    |When interpreting, ' xyz EXECUTE is equivalent to xyz.

    one can argue that ' should return the xt representing the
    interpretation semantics of the word.

    Could you elaborate what does "represent" formally mean in this context?


    A practical question is: having an xt that represents the interpretation semantics for a word, how to perform (in the general case) the behavior
    that takes place when the Forth text interpreter encounters this word in interpretation state?

    To perform this behavior, should this xt be executed in interpretation
    state, or it can be executed regardless of STATE?




    [...]

    --
    Ruvim

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Krishna Myneni@21:1/5 to Anton Ertl on Sun Oct 9 16:42:59 2022
    On 10/9/22 10:20, Anton Ertl wrote:
    Krishna Myneni <krishna.myneni@ccreweb.org> writes:
    Yes, both "interpretation semantics" and "compilation semantics" are
    types of execution semantics, which should be obvious by the fact that
    they can be represented by tokens on the stack which, when EXECUTEd will
    perform the behavior required in the appropriate STATE, as illustrated
    by the one-line text interpreter.

    I don't think it is particularly useful to think of interpretation
    semantics as a type of execution semantics, just because it is
    represented by an xt. And looking at <https://forth-standard.org/proposals/reword-the-term-execution-token-?hideDiff#reply-742>,
    all voting members in the 2021 Forth200x meeting agreed.


    I don't really see how the above rewording for the definition of
    execution token implies that it is not useful to represent
    interpretation semantics by an xt.

    Yes, you can argue that for :noname definitions we talk only about
    execution semantics (and they are represented by an xt), and therefore
    the xt we get from NAME>INTERPRET for a named word also represents
    some kind of execution semantics, but what would be the point?


    In a single-xt system, the xt represents either interpretation semantics
    or compilation semantics depending on a flag (the immediate flag). In
    the dual-xt system these are two different xt's. I think the benefit is
    that we can stop using the term "execution semantics" in the standard
    and explicitly only use interpretation semantics or compilation
    semantics, at least when discussing words.

    Concerning compilation semantics, they are represented by ( x xt ),
    not just by an xt, so it's much harder to argue that there is some (anonymous) word around that has these compilation semantics as
    execution semantics. E.g., the compilation semantics of + might be represented by

    ' + ' compile,


    xt's in general may accept arguments on the stack or return them.
    Granted x is a significant part of the compilation semantics, but, just
    like all other words which accept arguments, it is implicitly necessary
    for the arguments to be present otherwise an ambiguous condition results.

    --
    Krishna

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Anton Ertl@21:1/5 to Krishna Myneni on Mon Oct 10 17:00:42 2022
    Krishna Myneni <krishna.myneni@ccreweb.org> writes:
    On 10/9/22 02:51, Anton Ertl wrote:
    Krishna Myneni <krishna.myneni@ccreweb.org> writes:
    On 10/4/22 16:36, Ruvim wrote:
    [...]
    In a dual-token system there are explicitly two types of
    execution semantics: "interpretation semantics" or "compilation
    semantics."

    I would say: There is interpretation semantics and there is
    compilation semantics. There have been some arguments that execution
    semantics is a third entity, but given that there are no words that
    have defined execution semantics and defined interpretation semantics
    where these two differ, I view execution semantics for a named word as
    a helper concept for defining interpretation and/or compilation
    semantics.


    Yes, it should be "interpretation semantics" and "compilation
    semantics". Execution semantics, in concrete form, is represented by an
    xt.

    The xt coming out of NAME>INTERPRET represents the interpretation
    semantics of the word.

    When the xt is EXECUTEd, the "execution semantics" are performed.

    If an xt represents the execution semantics of some word, then yes,
    it's EXECUTE performs its execution semantics.

    Likewise, "interpretation semantics" and "compilation semantics" may be >represented by xt's. They are simply particular types of execution
    semantics.

    I don't think it's useful to drag execution semantics into that any
    more than it already is.

    It is easier to understand which one we are talking about.
    In contrast, for a traditional system, we have to determine whether the
    single xt representing execution semantics for a word corresponds to
    compilation semantics or to interpretation semantics by checking the
    precedence flag for the word.

    Actually, in a traditional single-xt+immediate-flag system, the xt
    always represents the interpretation semantics, and is always part of
    the compilation semantics: if the word is immediate, the compilation
    semantics are to EXECUTE the xt (immediate compilation semantics),
    otherwise they are to COMPILE, the xt (default compilation semantics).
    There is no way to create words with compilation semantics that are
    neither default nor immediate.


    I don't see any distinction between your description and mine

    I point out that on such a system the xt always represents the
    interpretation semantics. For immediate word it also represents the compilation semantics. You claimed an either/or relationship.

    For other cases, the compilation semantics may differ from the
    initialized compilation semantics, e.g. when the new compilation
    semantics includes the older one but provides additional behavior to >instrument the word's usage.

    Instrumentation does not try to change the behaviour on the level that
    is observable in the uninstrumented program. Therefore IMO you can
    plug it into COMPILE, just as well as into compilation semantics. I
    doubt that anybody will complain that in Gforth text interpretation
    records the interpreted words (for WHERE), or that COMPILE, records
    information for use in backtracing, even though the standard does not
    specify that. Except maybe about the resource consumption.

    - anton
    --
    M. Anton Ertl http://www.complang.tuwien.ac.at/anton/home.html
    comp.lang.forth FAQs: http://www.complang.tuwien.ac.at/forth/faq/toc.html
    New standard: https://forth-standard.org/
    EuroForth 2022: https://euro.theforth.net

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Anton Ertl@21:1/5 to Ruvim on Mon Oct 24 15:24:31 2022
    Ruvim <ruvim.pinka@gmail.com> writes:
    On 2022-10-07 03:01, Krishna Myneni wrote:
    In a dual-xt system, which xt do you expect tick or ['] to return?
    xt-interp or xt-comp? It should return xt-interp for backward
    compatibility with single-xt systems.

    The standard does not specify a notion of xt-interp or xt-comp.


    The standard specifies:

    |6.1.1550 FIND
    |
    |[...] For a given string, the values returned by FIND while compiling
    |may differ from those returned while not compiling

    They wanted to include cmForth-like systems (similar to what Krishna
    Myneni has in mind), where, e.g., for + FIND would return an xt for
    compiling + and 1 in compile state, while it would return an xt for
    performing + in interpret state. Two xts, which you might call
    xt-interp and xt-comp.

    On any standard system Tick shall return an xt that identifies the
    execution semantics of a word.

    |6.1.0070 '
    |
    |[...] When interpreting, ' xyz EXECUTE is equivalent to xyz.

    So the xt returned by ' identifies the interpretation semantics.

    When execution semantics are not specified for a standard word, the
    system may provide implementation-dependent execution semantics for the
    word. But it's ambiguous to perform these execution semantics in the
    general case, and it's ambiguous even to apply Tick to such a standard word.

    Interestingly:

    |4.1.2 Ambiguous conditions
    |
    |[...] attempting to obtain the execution token, (e.g., with 6.1.0070
    |', 6.1.1550 FIND, etc. of a definition with undefined interpretation |semantics;

    Interestingly, I don't find such an ambiguous condition for obtaining
    the execution token of a word with undefined execution semantics.

    I would not provide the "name>interpret" and "name>compile" words since
    they are flawed by design and insufficiently specified to be usable on
    any standard system.

    I find them fine, and use them all the time.

    - anton
    --
    M. Anton Ertl http://www.complang.tuwien.ac.at/anton/home.html
    comp.lang.forth FAQs: http://www.complang.tuwien.ac.at/forth/faq/toc.html
    New standard: https://forth-standard.org/
    EuroForth 2022: https://euro.theforth.net

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Krishna Myneni@21:1/5 to Ruvim on Mon Oct 24 21:55:19 2022
    On 10/8/22 04:38, Ruvim wrote:
    On 2022-10-07 03:01, Krishna Myneni wrote:
    On 10/6/22 15:40, Ruvim wrote:
    On 2022-10-05 09:26, Krishna Myneni wrote:


    [...]


    It sounds incorrectly. By this wording you revoke access to the
    identifier of the execution semantics for a word.


    Not really. In a dual-token system there are explicitly two types of
    execution semantics: "interpretation semantics" or "compilation
    semantics." It is easier to understand which one we are talking
    about. In contrast, for a traditional system, we have to determine
    whether the single xt representing execution semantics for a word
    corresponds to compilation semantics or to interpretation semantics
    by checking the precedence flag for the word.


    The standard allows the single-xt approach in implementations as well
    as dual-xt or dual-nt approach. And it specifies an abstract model
    over all possible implementation variants. And it specifies (should
    specify) only APIs that don't depend on a particular implementation
    or approach. And a standard program is not bothered whether it runs
    on a single-xt system, or on a dual-xt system.

    The standard specifies the execution semantics term, and the Tick
    method (among other) to obtain an execution token for a word that
    identifies the execution semantics of the word. To perform the
    interpretation semantics for the word, "execute" should be applied to
    this token in interpretation state. It's true for any standard
    system, regardless whether it's a single-xt system or dual-xt system.



    Sure, we can classify execution semantics by some types, according to
    their internal properties. For example, execution semantics can be
    either STATE-dependent or STATE-independent.

    But "interpretation semantics" and "compilation semantics" are not
    types of execution semantics. These terms are already occupied and
    defined in the standard.  Don't clutter them with other meanings.
    Choose other names.


    Yes, both "interpretation semantics" and "compilation semantics" are
    types of execution semantics, which should be obvious by the fact that
    they can be represented by tokens on the stack which, when EXECUTEd
    will perform the behavior required in the appropriate STATE, as
    illustrated by the one-line text interpreter.




    Well, then please provide definitions of these types, and criteria — how
    to detect whether an xt identifies execution semantics of one or another type.


    An xt present on the stack only defines some semantics when it is
    EXECUTED. The xt does not contain information about whether it is "interpretation semantics" or "compilation semantics", and it makes no
    sense to do so. xt does not have to be associated with a named definition.

    6.1.1370 EXECUTE
    CORE
    ( i * x xt – – j * x )
    Remove xt from the stack and perform the semantics identified by it. ...

    See description of EXECUTE in the standard.

    An xt performs the same action when EXECUTEd, regardless of the STATE,
    *unless* it happens to be state-smart.

    "Interpretation semantics" and "compilation semantics" of a word (a
    named definition) are only pertinent to what the text interpreter does
    with the xt. When the text interpreter parses a name it either executes xt-interp or xt-comp associated with the word, based on STATE.

    --
    Krishna

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)