• WINTERPRET

    From none) (albert@21:1/5 to All on Sun Oct 8 20:18:37 2023
    Since a long time (meta compilers for the 8051 while ISO was
    new) the Dutch community has a word WINTERPRET that sees
    it use mainly for meta compilers.

    This word interprets a string constant, and thus INTERPRET
    is a loop over this word. Naturally it terminates on
    a string with length zero.
    ( NAME would be something like `` BL WORD COUNT '' )

    : INTERPRET
    BEGIN NAME DUP WHILE WINTERPRET ?STACK REPEAT 2DROP ;

    WINTERPRET comes in handy for my lisp efforts too, 1]
    but I'm inclined to name it INTERPRET-TOKEN.

    1. Are others using this factor of INTERPRET ?
    2. Is the name WINTERPRET common ?
    3. Is this known under another name?

    As far as 2 is concerned I expect not. WINTERPRET is a
    Dutch word and its meaning is `` winter fun ''.
    This cuteness is not a good base for a name, and I can't
    relate it to any naming convention in Forth, prefixing a single
    character.

    1]
    In lisp a ' is supposed to parse another token and transform it like so: '<item> --> (quote <item> )
    Such words can be generated by a defining word:
    : define-quote CREATE $, DROP PREFIX DOES>
    empty() SWAP $@ symbol-append interpret-token build-list
    vector-append ; PREFIX

    Example:
    "quote" define-quote '
    and
    "deref" define-quote @

    Note that <item> can be a list `` (+ 1 2) '' that is parsed by
    the prefix `` ( '' or any type that is determined by the
    first character: 1 " ( [ a b .. z

    Groetjes Albert
    --
    Don't praise the day before the evening. One swallow doesn't make spring.
    You must not say "hey" before you have crossed the bridge. Don't sell the
    hide of the bear until you shot it. Better one bird in the hand than ten in
    the air. First gain is a cat spinning. - the Wise from Antrim -

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From NN@21:1/5 to none albert on Sun Oct 8 16:38:38 2023
    On Sunday, 8 October 2023 at 19:18:51 UTC+1, none albert wrote:
    Since a long time (meta compilers for the 8051 while ISO was
    new) the Dutch community has a word WINTERPRET that sees
    it use mainly for meta compilers.

    This word interprets a string constant, and thus INTERPRET
    is a loop over this word. Naturally it terminates on
    a string with length zero.
    ( NAME would be something like `` BL WORD COUNT '' )

    : INTERPRET
    BEGIN NAME DUP WHILE WINTERPRET ?STACK REPEAT 2DROP ;

    WINTERPRET comes in handy for my lisp efforts too, 1]
    but I'm inclined to name it INTERPRET-TOKEN.

    1. Are others using this factor of INTERPRET ?
    2. Is the name WINTERPRET common ?
    3. Is this known under another name?

    As far as 2 is concerned I expect not. WINTERPRET is a
    Dutch word and its meaning is `` winter fun ''.
    This cuteness is not a good base for a name, and I can't
    relate it to any naming convention in Forth, prefixing a single
    character.

    1]
    In lisp a ' is supposed to parse another token and transform it like so: '<item> --> (quote <item> )
    Such words can be generated by a defining word:
    : define-quote CREATE $, DROP PREFIX DOES>
    empty() SWAP $@ symbol-append interpret-token build-list
    vector-append ; PREFIX

    Example:
    "quote" define-quote '
    and
    "deref" define-quote @

    Note that <item> can be a list `` (+ 1 2) '' that is parsed by
    the prefix `` ( '' or any type that is determined by the
    first character: 1 " ( [ a b .. z

    Groetjes Albert
    --
    Don't praise the day before the evening. One swallow doesn't make spring.
    You must not say "hey" before you have crossed the bridge. Don't sell the hide of the bear until you shot it. Better one bird in the hand than ten in the air. First gain is a cat spinning. - the Wise from Antrim -



    What you have named interpret I just called repl() and so interpret is free to be
    used as as interpret()

    Any reason why you didnt just call it eval ( or a variation of )?

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From none) (albert@21:1/5 to november.nihal@gmail.com on Mon Oct 9 11:17:34 2023
    In article <ff47651a-c8d8-44a6-ad5f-b7c0eb6e0500n@googlegroups.com>,
    NN <november.nihal@gmail.com> wrote:
    On Sunday, 8 October 2023 at 19:18:51 UTC+1, none albert wrote:
    Since a long time (meta compilers for the 8051 while ISO was
    new) the Dutch community has a word WINTERPRET that sees
    it use mainly for meta compilers.

    This word interprets a string constant, and thus INTERPRET
    is a loop over this word. Naturally it terminates on
    a string with length zero.
    ( NAME would be something like `` BL WORD COUNT '' )

    : INTERPRET
    BEGIN NAME DUP WHILE WINTERPRET ?STACK REPEAT 2DROP ;

    WINTERPRET comes in handy for my lisp efforts too, 1]
    but I'm inclined to name it INTERPRET-TOKEN.

    1. Are others using this factor of INTERPRET ?
    2. Is the name WINTERPRET common ?
    3. Is this known under another name?

    As far as 2 is concerned I expect not. WINTERPRET is a
    Dutch word and its meaning is `` winter fun ''.
    This cuteness is not a good base for a name, and I can't
    relate it to any naming convention in Forth, prefixing a single
    character.

    1]
    In lisp a ' is supposed to parse another token and transform it like so:
    '<item> --> (quote <item> )
    Such words can be generated by a defining word:
    : define-quote CREATE $, DROP PREFIX DOES>
    empty() SWAP $@ symbol-append interpret-token build-list
    vector-append ; PREFIX

    Example:
    "quote" define-quote '
    and
    "deref" define-quote @

    Note that <item> can be a list `` (+ 1 2) '' that is parsed by
    the prefix `` ( '' or any type that is determined by the
    first character: 1 " ( [ a b .. z

    Groetjes Albert



    What you have named interpret I just called repl() and so interpret is
    free to be
    used as as interpret()

    Take a better read. Evaluate is a loop over words, with an important
    function to isolate those words.
    WINTERPRET is a factor that has as an input a single token,
    already isolated from the environment.


    Any reason why you didnt just call it eval ( or a variation of )?

    Any reason why I should? EVAL is not an established Forth word,
    and the name doesn't suggest that it looks up a single name to execute
    a single action. So what do you even mean?

    Groetjes Albert
    --
    Don't praise the day before the evening. One swallow doesn't make spring.
    You must not say "hey" before you have crossed the bridge. Don't sell the
    hide of the bear until you shot it. Better one bird in the hand than ten in
    the air. First gain is a cat spinning. - the Wise from Antrim -

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Ruvim@21:1/5 to albert on Sat Oct 14 09:18:49 2023
    On 2023-10-08 18:18, albert wrote:
    Since a long time (meta compilers for the 8051 while ISO was
    new) the Dutch community has a word WINTERPRET that sees
    it use mainly for meta compilers.

    This word interprets a string constant, and thus INTERPRET
    is a loop over this word. Naturally it terminates on
    a string with length zero.
    ( NAME would be something like `` BL WORD COUNT '' )

    : INTERPRET
    BEGIN NAME DUP WHILE WINTERPRET ?STACK REPEAT 2DROP ;

    WINTERPRET comes in handy for my lisp efforts too, 1]
    but I'm inclined to name it INTERPRET-TOKEN.

    1. Are others using this factor of INTERPRET ?
    2. Is the name WINTERPRET common ?
    3. Is this known under another name?

    In SP-Forth/4 there is a similar word:
    EVAL-WORD ( i*x sd.name -- j*x )

    It translates only a word name (it throws an exception if the word is
    not found). So, it cannot be used in the Forth text interpreter loop.


    I use the word TRANSLATE-LEXEME ( i*x sd.lexeme -- j*x )
    that translates any lexeme according to the current state.

    To translate a lexeme: to recognize a lexeme and perform the compilation semantics for it if the Forth text interpreter is in compilation state,
    or the interpretation semantics if in interpretation state.


    The name "INTERPRET-TOKEN" is confusing, since:
    1. It can mean both performing interpretation semantics regardless of
    the state, and translating (according to the above term definition).
    2. "Token" can mean execution token, name token, or other similar thing,
    or "lexical token" (which is a pair of a lexeme and *its kind*). And
    what this word actually implies is not from this list.



    --
    Ruvim

    --- 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 14 21:48:03 2023
    In article <ugdmdp$3pgl5$1@dont-email.me>,
    Ruvim <ruvim.pinka@gmail.com> wrote:
    On 2023-10-08 18:18, albert wrote:
    Since a long time (meta compilers for the 8051 while ISO was
    new) the Dutch community has a word WINTERPRET that sees
    it use mainly for meta compilers.

    This word interprets a string constant, and thus INTERPRET
    is a loop over this word. Naturally it terminates on
    a string with length zero.
    ( NAME would be something like `` BL WORD COUNT '' )

    : INTERPRET
    BEGIN NAME DUP WHILE WINTERPRET ?STACK REPEAT 2DROP ;

    WINTERPRET comes in handy for my lisp efforts too, 1]
    but I'm inclined to name it INTERPRET-TOKEN.

    1. Are others using this factor of INTERPRET ?
    2. Is the name WINTERPRET common ?
    3. Is this known under another name?

    In SP-Forth/4 there is a similar word:
    EVAL-WORD ( i*x sd.name -- j*x )

    It translates only a word name (it throws an exception if the word is
    not found). So, it cannot be used in the Forth text interpreter loop.

    I don't follow the logic. It is not true for at least one implementation
    model. I can factor out INTERPRET-TOKEN out of INTERPRET in ciforth. INTERPRET-TOKEN throws exceptions all the time.

    I use the word TRANSLATE-LEXEME ( i*x sd.lexeme -- j*x )
    that translates any lexeme according to the current state.

    As English dictionaries go:
    INTERPRET is approximately the same TRANSLATE
    TOKEN is approximately the same as LEXEME
    So we are not far apart.


    To translate a lexeme: to recognize a lexeme and perform the compilation >semantics for it if the Forth text interpreter is in compilation state,
    or the interpretation semantics if in interpretation state.


    The name "INTERPRET-TOKEN" is confusing, since:
    1. It can mean both performing interpretation semantics regardless of
    the state, and translating (according to the above term definition).
    2. "Token" can mean execution token, name token, or other similar thing,
    or "lexical token" (which is a pair of a lexeme and *its kind*). And
    what this word actually implies is not from this list.

    You can argue a name by logic, for now.
    It is established by convention by a Standards team.
    Not all of Forth names are logical ...

    So we have
    WINTERPRET
    INTERPRET-TOKEN
    EVAL-WORD
    TRANSLATE-LEXEME

    The conclusion is that it is a solid concept, reinvented many times,
    and that it is deserving of a definitive name.


    --
    Ruvim

    --
    Don't praise the day before the evening. One swallow doesn't make spring.
    You must not say "hey" before you have crossed the bridge. Don't sell the
    hide of the bear until you shot it. Better one bird in the hand than ten in
    the air. First gain is a cat spinning. - the Wise from Antrim -

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Ruvim@21:1/5 to albert on Sat Oct 14 23:59:15 2023
    On 2023-10-14 19:48, albert wrote:
    In article <ugdmdp$3pgl5$1@dont-email.me>,
    Ruvim <ruvim.pinka@gmail.com> wrote:
    On 2023-10-08 18:18, albert wrote:
    Since a long time (meta compilers for the 8051 while ISO was
    new) the Dutch community has a word WINTERPRET that sees
    it use mainly for meta compilers.

    This word interprets a string constant, and thus INTERPRET
    is a loop over this word. Naturally it terminates on
    a string with length zero.
    ( NAME would be something like `` BL WORD COUNT '' )

    : INTERPRET
    BEGIN NAME DUP WHILE WINTERPRET ?STACK REPEAT 2DROP ;

    WINTERPRET comes in handy for my lisp efforts too, 1]
    but I'm inclined to name it INTERPRET-TOKEN.

    1. Are others using this factor of INTERPRET ?
    2. Is the name WINTERPRET common ?
    3. Is this known under another name?

    In SP-Forth/4 there is a similar word:
    EVAL-WORD ( i*x sd.name -- j*x )

    It translates only a word name (it throws an exception if the word is
    not found). So, it cannot be used in the Forth text interpreter loop.

    I don't follow the logic. It is not true for at least one implementation model. I can factor out INTERPRET-TOKEN out of INTERPRET in ciforth. INTERPRET-TOKEN throws exceptions all the time.

    What I mean is that the word "EVAL-WORD" tries to recognize a lexeme
    only as a Forth word (a named Forth definition). And the "WORD"
    component in its name implies exactly this.

    In Forth-2012 this word can be defined as follows.

    : compilation ( -- flag ) state @ 0<> ;
    : ?found ( x -- x | 0 -- ) dup 0= -13 and throw ;

    \ NB: programs never actually need to analyze
    \ the result of "name>interpret" for zero.
    : name> ( nt -- xt )
    name>interpret ( nt -- xt|0 )
    dup if exit then drop [: -14 throw ;]
    ;

    : eval-word ( i*x sd.name -- j*x )
    find-name ?found
    compilation if name>compile else name> then execute
    ;

    Of course, a better choice was to extract the corresponding part of the
    Forth text interpreter loop into a separate word completely.



    I use the word TRANSLATE-LEXEME ( i*x sd.lexeme -- j*x )
    that translates any lexeme according to the current state.

    As English dictionaries go:
    INTERPRET is approximately the same TRANSLATE
    TOKEN is approximately the same as LEXEME
    So we are not far apart.

    Yes! Moreover, each of them has many different meanings (depending on
    the context).

    It's just that in the context of the Forth languages, "token" already
    has some other meaning.

    And "interpret" has both meanings, so "translate" is more unequivocal.

    The "translate" term is applicable not only to a lexeme, but also to a
    name token, execution token, number (on the stack), etc.

    For example, the following useful words can be defined using the
    "translate" term:

    : lit, postpone literal ; \ just a well-known factor

    : translate-lit ( x -- x| )
    compilation if lit, then
    ;
    : translate-xt ( i*x xt -- j*x )
    compilation if compile, exit then execute
    ;
    : translate-name ( i*x nt -- j*x )
    compilation if name>compile else name> then execute
    ;


    And then, "eval-word" can be defined as:

    : eval-word ( i*x sd.name -- j*x )
    find-name ?found translate-name
    ;

    [...]

    So we have
    WINTERPRET
    INTERPRET-TOKEN
    EVAL-WORD
    TRANSLATE-LEXEME

    The conclusion is that it is a solid concept, reinvented many times,
    and that it is deserving of a definitive name.

    I agree.



    --
    Ruvim

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