Path: csiph.com!usenet.pasdenom.info!aioe.org!.POSTED!not-for-mail From: "Rod Pemberton" Newsgroups: comp.lang.forth Subject: Re: Forth reinvention Date: Thu, 20 Feb 2014 16:16:15 -0500 Organization: Aioe.org NNTP Server Lines: 89 Message-ID: References: NNTP-Posting-Host: CNsg4fVcCsvs3UaOgZtQCw.user.speranza.aioe.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit X-Complaints-To: abuse@aioe.org User-Agent: Opera Mail/12.16 (Linux) X-Notice: Filtered by postfilter v. 0.8.2 Xref: csiph.com comp.lang.forth:28623 On Thu, 20 Feb 2014 09:56:59 -0500, Alex McDonald wrote: > on 20/02/2014 10:07:32, "Rod Pemberton" wrote: > >> Of course, once you eliminate infix from Forth, progress towards use > > You mean postfix. Yes, true, sorry. Technically, I meant to eliminate prefix too, not just postfix. So, unfortunately, 'eliminate' was actually the opposite meaning of what I meant. >> of symbols for logical, binary, math operations, begin to use curly > > Forth doesn't have logical operations. > If that were true, there would be no need for a "well formed flag" in Forth. That was debated here recently and it seems you've supported use of "well formed flags" in other threads. >> braces, and eliminate the work of the user keeping track of stack > > Forth doesn't have a block structure. It does. E.g., this is a block structure: ( ... singular pre-computed condition on data stack ... ) IF ( ... block ... ) ELSE ( ... block ... ) THEN Of course, Forth is not always expressed as well formatted text, and doesn't have to be. All of Forth's control-flow has words to mark the beginning and ending of each block. This is like many other languages, but especially block oriented scripting languages. But, I'll demonstrate in COBOL (a language I've never programmed BTW): IF ( ... set of conditions ... ) THEN ( ... block ... ) ELSE ( ... block ... ) END-IF The THEN keyword for Forth and END-IF keyword for COBOL are needed because they're block structured. Inherently, all programming languages are. Of course, in C the syntax uses braces, if the block is more than just one statement: if /* conditions */ { /* block */ } else { /* block */ } You can do the same thing with any other control flow too, e.g., DO .. LOOP , ?DO .. +LOOP , BEGIN .. AGAIN , BEGIN .. UNTIL , BEGIN .. WHILE .. REPEAT , Eaker's case, etc. Basically, the curly braces mark some of the locations where branches for assembly or binary are placed in C. These locations correspond to where they are used in Forth control-flow words too. Some Forths use BRANCH and 0BRANCH or ?BRANCH to place these branches. The keywords in C mark some of other locations just as in Forth. The rest are escape control-flow words like UNLOOP and EXIT in Forth or 'break', 'continue' or 'goto' in C. Block http://en.wikipedia.org/wiki/Block_(programming) Control-flow http://en.wikipedia.org/wiki/Control_flow Rod Pemberton