Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.forth > #10660
| From | "Rod Pemberton" <do_not_have@noavailemail.cmm> |
|---|---|
| Newsgroups | comp.lang.forth |
| Subject | Re: Does ?DO force DO to become bloated? |
| Date | 2012-03-31 03:29 -0400 |
| Organization | Aioe.org NNTP Server |
| Message-ID | <jl6bon$mnj$1@speranza.aioe.org> (permalink) |
| References | <jl5cp3$tev$1@speranza.aioe.org> <4f7645ed$0$23410$882e7ee2@usenet-news.net> |
"Josh Grams" <josh@qualdan.com> wrote in message news:4f7645ed$0$23410$882e7ee2@usenet-news.net... > Rod Pemberton wrote: <jl5cp3$tev$1@speranza.aioe.org> > > Does ?DO force DO 's definition to become bloated? > > It shouldn't change DO at all. ... > ?DO should basically compile `2DUP <> IF DO`, ?DO first compiles (?DO) which is currently `2DUP <>` in my case. That's followed by the definition of IF inlined into ?DO . I've yet to find out why IF itself won't work there. I thought it was an issue with needing COMPILE or [COMPILE] but maybe IF just needed to be in (?DO) ... Continuing, that's followed by compiling (DO) which is what DO compiles. Finally, there is a HERE at the end of ?DO . The HERE is definately different from what you mentioned. Otherwise, it's probably equivalent. So, when using ?DO there are two HERE addresses on the stack, one due to the IF and one by the explict HERE. One address is for looping and the other is for the conditional branch in ?DO . That means that LOOP and +LOOP are always getting two addresses from ?DO . So, they must be coded to use both of them. That means that DO must also supply two addresses, not just one. Yes? If only one is provided by DO , then a stack underflow will occur. I.e., that implies that DO 's code must mirror the implementation of ?DO in terms of placing addresses on the stack. If LOOP and +LOOP didn't have to backfill in the conditional forward address from ?DO , then DO would be simpler. (Just prior to me posting this, Ms. Rather posted a solution which doesn't require both DO and ?DO putting two addresses onto the stack.) > [...] and the IF's compile-time info should be stored so > that it will be resolved as if it were a LEAVE. > Are you talking about the linked-list created "leave" and "rake" chaining implementation of LEAVES? > Do you have LEAVE yet? No. > I'd implement that before ?DO. Why? ISTM that the "leaves-rake" method is complicated. ISTM also that it doesn't fit well with the other control-flow words. From what I can tell, it seems that ANS LEAVE also requires a forward reference branch address that must be resolved, like ?DO . I'm not sure yet how to work that into DO ?DO LOOP +LOOP yet. AIUI, the old fig-Forth LEAVE didn't immediately exit the loop. It just changed the parameters so the loop exited. Having to implement a LEAVE which immediately exits the loop is making me hesistant. Rod Pemberton
Back to comp.lang.forth | Previous | Next — Previous in thread | Next in thread | Find similar
Does ?DO force DO to become bloated? "Rod Pemberton" <do_not_have@noavailemail.cmm> - 2012-03-30 18:40 -0400
Re: Does ?DO force DO to become bloated? "Elizabeth D. Rather" <erather@forth.com> - 2012-03-30 13:24 -1000
Re: Does ?DO force DO to become bloated? Hans Bezemer <the.beez.speaks@gmail.com> - 2012-03-31 20:56 +0200
Re: Does ?DO force DO to become bloated? "Rod Pemberton" <do_not_have@noavailemail.cmm> - 2012-04-01 06:06 -0400
Re: Does ?DO force DO to become bloated? "Elizabeth D. Rather" <erather@forth.com> - 2012-04-01 07:57 -1000
Re: Does ?DO force DO to become bloated? Hans Bezemer <the.beez.speaks@gmail.com> - 2012-04-02 19:14 +0200
Re: Does ?DO force DO to become bloated? "Rod Pemberton" <do_not_have@notemailnot.cmm> - 2012-04-03 06:02 -0400
Re: Does ?DO force DO to become bloated? BruceMcF <agila61@netscape.net> - 2012-03-31 12:32 -0700
Re: Does ?DO force DO to become bloated? Josh Grams <josh@qualdan.com> - 2012-03-30 23:46 +0000
Re: Does ?DO force DO to become bloated? "Elizabeth D. Rather" <erather@forth.com> - 2012-03-30 20:58 -1000
Re: Does ?DO force DO to become bloated? "Rod Pemberton" <do_not_have@noavailemail.cmm> - 2012-03-31 03:31 -0400
Re: Does ?DO force DO to become bloated? "Elizabeth D. Rather" <erather@forth.com> - 2012-03-31 08:25 -1000
Re: Does ?DO force DO to become bloated? BruceMcF <agila61@netscape.net> - 2012-03-31 12:02 -0700
Re: Does ?DO force DO to become bloated? "Rod Pemberton" <do_not_have@notemailnot.cmm> - 2012-04-03 06:01 -0400
Re: Does ?DO force DO to become bloated? "Elizabeth D. Rather" <erather@forth.com> - 2012-04-03 08:38 -1000
Re: Does ?DO force DO to become bloated? "Rod Pemberton" <do_not_have@notemailnot.cmm> - 2012-04-04 05:24 -0400
Re: Does ?DO force DO to become bloated? "Elizabeth D. Rather" <erather@forth.com> - 2012-04-04 07:44 -1000
Re: Does ?DO force DO to become bloated? Albert van der Horst <albert@spenarnc.xs4all.nl> - 2012-04-05 11:51 +0000
Re: Does ?DO force DO to become bloated? mhx@iae.nl (Marcel Hendrix) - 2012-04-05 21:10 +0200
Re: Does ?DO force DO to become bloated? "Rod Pemberton" <do_not_have@notemailnot.cmm> - 2012-04-05 09:33 -0400
Re: Does ?DO force DO to become bloated? "Elizabeth D. Rather" <erather@forth.com> - 2012-04-05 08:12 -1000
Re: Does ?DO force DO to become bloated? BruceMcF <agila61@netscape.net> - 2012-04-04 07:23 -0700
Re: Does ?DO force DO to become bloated? "Rod Pemberton" <do_not_have@notemailnot.cmm> - 2012-04-05 09:50 -0400
Re: Does ?DO force DO to become bloated? BruceMcF <agila61@netscape.net> - 2012-04-05 12:26 -0700
Re: Does ?DO force DO to become bloated? "Rod Pemberton" <do_not_have@noavailemail.cmm> - 2012-03-31 03:29 -0400
Re: Does ?DO force DO to become bloated? Josh Grams <josh@qualdan.com> - 2012-03-31 09:58 +0000
Re: Does ?DO force DO to become bloated? segher <segher@kernel.crashing.org> - 2012-03-31 04:21 -0700
Re: Does ?DO force DO to become bloated? BruceMcF <agila61@netscape.net> - 2012-03-31 07:19 -0700
Re: Does ?DO force DO to become bloated? Hans Bezemer <the.beez.speaks@gmail.com> - 2012-03-31 15:29 +0200
Re: Does ?DO force DO to become bloated? "Rod Pemberton" <do_not_have@noavailemail.cmm> - 2012-03-31 20:28 -0400
Re: Does ?DO force DO to become bloated? BruceMcF <agila61@netscape.net> - 2012-03-31 19:48 -0700
Re: Does ?DO force DO to become bloated? BruceMcF <agila61@netscape.net> - 2012-03-31 07:43 -0700
csiph-web