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 117,640 of 117,927   
   Anton Ertl to dxf   
   Re: Conditional compilation   
   25 Oct 25 16:02:02   
   
   From: anton@mips.complang.tuwien.ac.at   
      
   dxf  writes:   
   >On 25/10/2025 11:51 pm, minforth wrote:   
   >> Am 25.10.2025 um 13:36 schrieb dxf:   
   >>> Put the following into a file and then load it:   
   >>>   
   >>> 1   
   >>>   
   >>> 0 [IF]   
   >>>   
   >>> 2   
   >>>   
   >>> 0 [IF]   
   >>>   
   >>> 3   
   >>>   
   >>> [THEN]   
   >>>   
   >>> .S   
   ...   
   >The implementation ANS-Forth provides in A.15.6.2.2533 leaves a 1 on the stack   
   >albeit undisplayed.   
      
   Of course there should be a 1 on the stack.  There is nothing that   
   removes it.  There is also nothing that displays it, so it's not   
   surprising that it's not displayed.   
      
   When you paste this code in a recent development Gforth, it becomes   
   pretty obvious what is happening:   
      
   1  ok 1   
     ok 1   
   0 [IF] scanning for [THEN]   
    scanning for [THEN]   
   2 scanning for [THEN]   
    scanning for [THEN]   
   0 [IF] scanning for [THEN]   
    scanning for [THEN]   
   3 scanning for [THEN]   
    scanning for [THEN]   
   [THEN] scanning for [THEN]   
    scanning for [THEN]   
   .S scanning for [THEN]   
      
   When you put it in a file and include that, you instead get:   
      
   include zzz.fs   
   zzz.fs:3:3: warning: unfinished [IF] at end of file ok 1   
      
   The end of the file finishes the [IF] for you in the development   
   version (it now says "ok", not "scanning for [THEN]", but not in   
   gforth-0.7.   
      
   - 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 2025 CFP: http://www.euroforth.org/ef25/cfp.html   
   EuroForth 2025 registration: https://euro.theforth.net/   
      
   --- 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