Path: utzoo!attcan!uunet!ogicse!ucsd!ucbvax!MITCH.ENG.SUN.COM!wmb From: wmb@MITCH.ENG.SUN.COM Newsgroups: comp.lang.forth Subject: Re: interpreted control structures Message-ID: <9009271317.AA13012@ucbvax.Berkeley.EDU> Date: 27 Sep 90 03:14:06 GMT Sender: daemon@ucbvax.BERKELEY.EDU Reply-To: wmb%MITCH.ENG.SUN.COM@SCFVM.GSFC.NASA.GOV Organization: The Internet Lines: 31 > Also to others who have used or created interpreted control structures: > > Would the following work: > > CREATE crc-table 255 0 DO I CRC-LOOKUP , LOOP > > If I have interpreted control structures, I would like to use them at compile > time to initialize tables. Are there systems that allow this? And what are > the complexities/tradeoffs involved? The code that I published in the FORML proceedings did not allow this, but my current implementation allows it, and the code the John Hayes published in a recent Forth Dimensions allows it also. To make it work, you have to switch the dictionary pointer to a separate area (usually called a "compile buffer") while compiling the temporary definition, and then switch the DP back to its original place just before executing the temporary definition. The tradeoffs are: 1) The size of the compile buffer limits the maximum size of a temporary definition. 2) You have to be careful that your ABORT mechanism puts the DP back to the right place if an ABORT happens during temporary compilation. (This is a good idea even if you don't use a separate compile buffer). The compile buffer idea is very old. Mitch Bradley, wmb@Eng.Sun.COM