Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!ucsd!ucbvax!MITCH.ENG.SUN.COM!wmb From: wmb@MITCH.ENG.SUN.COM (Mitch Bradley) Newsgroups: comp.lang.forth Subject: Re: >R, R> in interpret mode Message-ID: <9009242030.AA17111@ucbvax.Berkeley.EDU> Date: 24 Sep 90 18:06:40 GMT Sender: daemon@ucbvax.BERKELEY.EDU Reply-To: Mitch Bradley Organization: The Internet Lines: 53 > So how did you make >R and R> work in interpret mode, Mitch? I rearranged the text interpreter so that the word is EXECUTEd in the outer loop. Something like this: VARIABLE WORD-TO-EXECUTE : INTERPRET-WORD ( counted-string -- ) FIND (decide if the word should be compiled or executed) IF WORD-TO-EXECUTE ! \ If it should be executed ELSE , \ If it should be compiled THEN ; : INTERPRET BEGIN BL WORD DUP C@ WHILE ['] NOOP WORD-TO-EXECUTE ! INTERPRET-WORD WORD-TO-EXECUTE @ EXECUTE REPEAT DROP ; This isn't my exact code, but you get the idea. Another solution would be to write the outer interpreter as one big word, like in FIG Forth. The key point is that the "EXECUTE" must be at the same nesting level as the interpreter loop. Oh, one key point about my system, that makes this all possible: INTERPRET does not exit at the end of every line! In my implementation, WORD reads across line boundaries. Without this feature, the only solution I can think of offhand is to completely "unfactor" QUIT into one giant word, i.e. : QUIT BEGIN QUERY BEGIN BL WORD DUP C@ WHILE FIND ... EXECUTE ELSE , THEN REPEAT DROP AGAIN ; Mitch