Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!watmath!clyde!burl!ulysses!allegra!mit-eddie!genrad!decvax!ittatc!dcdwest!sdcsvax!sdcrdcf!trwrb!scgvaxd!wlbr!jplgodo!steve From: steve@jplgodo.UUCP (Steve Schlaifer x43171 156/224) Newsgroups: net.lang Subject: Re: RRe: What's so good about FORTH? Message-ID: <813@jplgodo.UUCP> Date: Tue, 17-Jun-86 13:23:57 EDT Article-I.D.: jplgodo.813 Posted: Tue Jun 17 13:23:57 1986 Date-Received: Thu, 19-Jun-86 19:47:38 EDT References: <201@pyuxv.UUCP> <3700003@uiucdcsp> <132@vaxb.calgary.UUCP> <634@ucbcad.BERKELEY.EDU> Organization: Jet Propulsion Labs, Pasadena, CA Lines: 33 Keywords: FORTH, threaded-code In article <634@ucbcad.BERKELEY.EDU>, keppel@pavepaws.berkeley.edu (David Keppel) writes: > [ Summary: What is threaded code? ] Essentially, threaded code consists of a long series of subroutine calls. In a threaded code implementation, the implementor writes some primitive words that actually use the machine instructions to perform the kernal operations needed. On top of this layer, the remaining (high level) words required to complete the language implementation are written as a series of calls to other words (either high level or primitive). In either direct or indirect threading, these calls are represented as just the address of the start of the code for the word to be executed (primitive word) or code needed to nest the interpretor down a level (high level word). A part of the threaded language system called the inner interpretor picks up each address in turn and then jumps to the code to be executed. The last operation performed in a word is usually a branch back to the inner interpretor. The compactness of threaded code comes from only needing 2 bytes to cause any word in the dictionary to be executed no matter how complex the operation actually is. Further, if the language is extensible like Forth, then any application specific sequence of operations that is going to be used frequently, can be added to the language and thereafter represented in the dictionary as just a 2 byte code address. A good book on threaded code is Threaded Interpretive Languages published by Byte Books. Also, Leo Brodie's book on Forth (I think it's called Starting Forth) has some good discussion of threading. -- ...smeagol\ Steve Schlaifer ......wlbr->!jplgodo!steve Advance Projects Group, Jet Propulsion Labs ....group3/ 4800 Oak Grove Drive, M/S 156/204 Pasadena, California, 91109 +1 818 354 3171