Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/3/84; site teddy.UUCP Path: utzoo!linus!decvax!genrad!panda!teddy!rmc From: rmc@teddy.UUCP Newsgroups: net.lang.forth Subject: Re: Virtues of Forth Message-ID: <1894@teddy.UUCP> Date: Tue, 7-Jan-86 14:42:47 EST Article-I.D.: teddy.1894 Posted: Tue Jan 7 14:42:47 1986 Date-Received: Wed, 8-Jan-86 20:36:52 EST References: <681@pucc-j> <187@aero.ARPA> Reply-To: rmc@teddy.UUCP (R. Mark Chilenskas) Organization: GenRad, Inc., Concord, Mass. Lines: 51 Keywords: AI, Scoping, Garbage Collection, FORTH, POP-11 Summary: I have also been interested in FORTH as an AI-ish language for small computers. In fact, the English have used a stack oriented language called POP for some time now (see for example POPLOG, a system containing an editor, several utilities, POP-11, Common Lisp and Prolog. POP-11 is used as the implementation language for the other parts of the environment, and the stack architecture makes the whole system mildly portable. University of Sussex is the originator, System Designers Software is the US distributor, and more information is also available in Pop-11, a book by Barrett, Ramsay and Sloman. I don't know the publisher of the book but SDS can probably give you order information). There are two moderately large problems with FORTH per se as an AI language. The first is scoping, the second is garbage collection. Together they make it rather hard to manage the large programs associated with AI techniques. The two scoping techniques used in Lisp are dynamic and lexical scoping. Dynamic scoping means that the most recent value of a procedure or variable gets used, regardless of who set the variable. Lexical scoping (Algol or C or Pascal technique) says that you can only set variables within your own routine, or those containing you if you look at a printed representation of the program. It turns out that dynamic scoping is simplest for implementing a naive interpreter, but that dynamic scoping has a number of advantages for avoiding name space conflicts and object oriented programming. FORTH scoping is sort of funny. I guess the best way to characterize it would be as dynamic scoping at compile / word definition time rather than at execution time. This means that you can't easily change the definition of a word and have the new definition take effect in existing words. This makes many of the ideas of using programs to build themselves (ie, putting knowledge in procedures) somewhat difficult to handle. A more important limitation is the absence of garbage collection. One of the important techniques in AI is to try to solve a problem and, if that solution fails, try again (ie, use backtracking). The structures describing the problem (schedule of actions in a robot plan, parse tree for a sentence, what have you) are large, and some of the structure is re-used in subsequent attemtpts to solve the problem. In FORTH, all your data ends up on the stack and in the dictionary, making recovering the space for unneeded data extremely complicated. So while there are interesting parallels between FORTH and Lisp, and attempts to use the stack architecture as a "portable engine" for implementing AI languages, it seems that FORTH has some limitations that make it awkward for supporting large, dynamic programs. R Mark Chilenskas decvax!genrad!panda!rmc