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,281 of 117,927   
   Hans Bezemer to All   
   Re: Having fun with embedded Forth in BA   
   04 May 25 13:12:19   
   
   From: the.beez.speaks@gmail.com   
      
   On 03-05-2025 18:01, Hans Bezemer wrote:   
   Okay, I'm done. I extended the vocabulary considerably, so now comments   
   are supported, ticking definitions, values are supported (TO, +TO),   
   strings, BEGIN..WHILE..UNTIL|REPEAT, IF..ELSE..THEN, EXECUTE.   
      
   Notoriously missing are (still) DO..LOOP. I also decided to "hide" the   
   code in REM statements, first: because those strange contraptions in the   
   '80-ies did the same and second, you can still execute the program as is.   
      
   Little example:   
      
   If Line(_Guesses) = 0 Then Print "Please transpile this program first   
   using \quBForth.bas\q." : End   
      
   Push Rnd(10)+1   
      
   Rem Forth   
   Rem : Guesses                              ( secret# #times --)   
   Rem   ." Guess a number between 1 and 10" cr   
   Rem   begin                                \ repeat n times   
   Rem     dup                                \ check number of guesses   
   Rem   while                                \ when ok   
   Rem     over   
   Rem uBasic   
      
   Input a : Push a   
      
   Rem Forth   
   Rem     over over = if ." Guessed!" cr abort then   
   Rem     ." Too " > if ." small" else ." big" then cr 1 -   
   Rem   repeat                              \ if guessed, exit   
   Rem   drop ." You didn't guess it, it was " . cr   
   Rem ;                                     \ error if not guessed   
   Rem uBasic   
      
   Proc _Guesses(3)   
      
   I'll see about this DO..LOOP ;-)   
      
   Hans Bezemer   
      
   --- SoupGate-DOS v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

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


(c) 1994,  bbs@darkrealms.ca