From: ruvim.pinka@gmail.com   
      
   On 2024-09-18 03:04, Stephen Pelc wrote:   
   > On 17 Sep 2024 at 21:12:08 CEST, "Anthony Howe" wrote:   
   >   
   >> On 2024-09-17 06:54, Ruvim wrote:   
   >>> Do you think that the Forth standard should recognize the classic single-xt   
   >>> approach as possible for implementing a standard Forth system?   
   >>>   
   >>> The classic single-xt approach implies that only one execution token (xt)   
   is   
   >>> associated with a name token (nt), and only one name token is associated   
   with a   
   >>> word (a named Forth definition). And words whose compilation semantics   
   differ   
   >>> form default compilation semantics are implemented as immediate words.   
   >>   
   >> Given I prefer single-xt (currently), what I don't get is how for a dual-xt   
   >> system you define a single word with two actions for interpret and compile.   
   I   
   >> don't see a word to distinguish between the two, except maybe IMMEDIATE.   
   >   
   > VFX Forth 64 is a single xt system (with sub-xts) .   
      
   If VFX Forth allows to obtain sub-xts from the main xt, then FVX Forth   
   effectively has multiple xts associated with an nt.   
      
   Moreover, in VFX Forth, the execution semantics of `FIND` depends on   
   STATE (at least, for some arguments). Therefore, VFX Forth does not   
   follow the classic single-xt approach.   
      
      
      
   > It manages to separate   
   > compilation and interpret actions for a word cleanly. S" is defined as   
   below:   
   >   
   > : S" \ Comp: "ccc" -- ; Run: -- c-addr u 6.1.2165   
   > \ *G Describe a string. Text is taken up to the next double-quote   
   > \ ** character. The address and length of the string are returned.   
   > [char] " parse >syspad   
   > ;   
   > ndcs: ( -- ) discard-sinline compile (s") ", ;   
   >   
   > NDCS: describes the non-default compilation sematics of the word.   
      
   This implementation is not standard compliant, because `compile,`, which   
   shall has stack effect ( xt -- ), consumes and produces some other stack   
   parameters for some xts, e.g.   
      
    ' if compile, \ actual effect( xt -- x )   
      
    ' then compile, \ actual effect ( x xt -- )   
      
      
   Or, in a standard program:   
      
    : test-compile(   
    state @ 0= -14 and throw   
    bl word find if compile, else -13 throw then   
    parse-name s" )" compare abort" ')' expected"   
    ; immediate   
      
    : foo test-compile( if ) ;   
      
    \ Err# -22 ERR: Control structure mismatch.   
      
      
   --   
   Ruvim   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   
|