Path: utzoo!utgpu!news-server.csri.toronto.edu!bonnie.concordia.ca!thunder.mcrcim.mcgill.edu!snorkelwacker.mit.edu!mit-eddie!uw-beaver!ubc-cs!alberta!alberta!ncc!idacom!rob From: rob@idacom.uucp (Rob Chapman) Newsgroups: comp.lang.forth Subject: ALTHOUGH, BUT Message-ID: <1991Jan23.102347.14029@idacom.uucp> Date: 23 Jan 91 10:23:47 GMT Organization: IDACOM, a division of Hewlett-Packard Lines: 61 Wil, you're inspiring. I've been disconnected from this news group for a few months now and the first thing I read when I return is Wil's BUT (no bun intended:) A comment on ALTHOUGH: right idea wrong approach. A better word would be SKIP which would skip ahead to AHEAD. Since ALTHOUGH is really just a forward manipulation of control flow, I also considered the words: FORWARD ONWARD (rlq) AHEAD FUTURE A note on SO: it seems that it might only be used for radical control flow. You defined : BUT 1 SO ; but as you mention, it is really just SWAP. This is sufficient for the simple coupling of Forth phrases with the control flow words IF ELSE ENDIF BEGIN WHILE REPEAT UNTIL AGAIN. Now, taking a departure from your factoring and F83 for control flow primitives, I present a different factoring where the marking, branching and resolving are separate words: ( ==== From botForth compiler. Syntax: { phrase }{ equivelant phrases } ==== ) { BEGIN }{ MARK } { IF }{ WHILE }{ MARK 0BRANCH } { ELSE }{ MARK BRANCH OTHER MARK >RESOLVE } { ENDIF }{ MARK >RESOLVE } { UNTIL }{ MARK 0BRANCH RESOLVE } ( Note: this definition of FOR NEXT loops exactly n times. ) ( It does this by starting at the end, -BRANCH, which branches when ) ( the index is not zero and then decrements the index register .) ( I've sent in the next for FOR NEXT proposal, Frank. ) { FOR }{ >I MARK BRANCH MARK OTHER } { NEXT }{ MARK >RESOLVE MARK -BRANCH I MARK } { NEXT }{ MARK -BRANCH RESOLVE ( a \ a -- ) resolve a branch forward I ( -- ) compile an index setter OTHER ( a \ b -- b \ a ) swap marks to allow phrase coupling A purist might argue that >RESOLVE and