home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   comp.lang.forth      Forth programmers eat a lot of Bratwurst      117,927 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 116,785 of 117,927   
   Hans Bezemer to albert@spenarnc.xs4all.nl   
   Re: single-xt approach in the standard   
   20 Sep 24 14:58:30   
   
   From: the.beez.speaks@gmail.com   
      
   On 19-09-2024 10:36, albert@spenarnc.xs4all.nl wrote:   
   > In article ,   
   > Hans Bezemer   wrote:   
   >> On 18-09-2024 12:34, Ruvim wrote:   
   >>> Actually, most Forth systems are classic single-xt systems. And most   
   >>> educational materials on how to implement Forth explain the classic   
   >>> single-xt approach.   
   >>   
   >> Interesting enough - considering this "dual xt" idea, 4tH has *ALWAYS*   
   >> been "dual xt". All compilation behavior is in the compiler and all   
   >> execution behavior is in the interpreter. Note 4tH *only* contains   
   >> primitives. The Forth layer is what you build with these primitives,   
   >> since both the compilation behavior and execution behavior is coded in C.   
   >   
   > And the opposite approach. Always have default compilation semantics,   
   > i.e. add the behaviour of an interpreted word to a compiled word.   
   That is handled by two tables in the 4tH compiler: one to add primitive   
   words *WITH* an argument (like built-in constants) and one for words   
   *WITHOUT* (like DUP, ROT, PARSE, etc).   
      
   Words which do not translate to simple "instruction(argument)" pairs are   
   in the third table (IF, VALUE, :, ;, etc.) And then there's the symbol   
   table which again, contains simple "instruction(argument)" pairs.   
      
   > If the compilation stack is separate, inspection of STATE   
   > can be restricted to INTERPRET , without even a need to   
   > be inspected by number, aka denotations.   
   > INTERPRET could simply inspect if the stack has changed.   
   > In compile mode, it compiles literals, instead of leaving   
   > them on the stack.   
      
   In certain situations the growing compilant is used as a stack in 4tH   
   i.e. the last word compiled *MUST* be a LITERAL for it to work.   
   Fortunately, the 4tH optimizer does a great job when constant folding.   
      
   Hans Bezemer   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca